Advertisement
chiabgigi

mike-social buttons

May 2nd, 2021
1,366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.20 KB | None | 0 0
  1.  
  2. in my opinion you should adopt this choice.
  3. Follow this guide and see what you solve
  4. https://blog.hubspot.com/blog/tabid/6307/bid/29544/the-ultimate-cheat-sheet-for-creating-social-media-buttons.aspx
  5. -------------
  6. as for the coosocial.php and db.php files
  7. the error is that you have to add this to all functions:
  8. #file coolsocial.php
  9. if(!function_exists('check_network')) {  // <------------------------------  THIS
  10.     function check_network($network)
  11.     {
  12.         global $db_link, $share_url, $ip, $get_count_minutes; // Version 1.1a - forgot to have $get_count_minutes here
  13.         $last_count = 0; // 1/17/2018 - Version 1.1 - Was $count = "N/A" // Version 1.1a - Changed $count to $last_count
  14.         $get_new_count = false;
  15.         $network_count = 0; // Version 1.1a - Added $network_count = 0
  16.  
  17.         // Check database for Network counts
  18.         $network = db_escape_string($db_link, substr($network, 0, 255)); // Don't strip_tags from urls
  19.  
  20.         $query = "SELECT *, TIMESTAMPDIFF(MINUTE, date_updated, NOW()) AS minutes
  21.                 FROM social_count WHERE url='$share_url' AND network='$network' LIMIT 1";
  22.         $result = db_query($db_link, $query);
  23.         if (db_num_rows($result)) {
  24.             $row = db_fetch_assoc($result);
  25.             $last_count = $row["count"];
  26.             if ($row['minutes'] > $get_count_minutes || isset($_POST['click'])) // Version 1.1a - Removed  "&& $row['minutes'] > 5" at end
  27.                 $get_new_count = true;
  28.         } else // No rows for this network, first time getting count
  29.             $get_new_count = true;
  30.  
  31.         //if (isset($_POST['click']) && ($row['ip'] != $ip || $last_count == 0)) // Version 1.1a - Moved to line 89
  32.         //  $count++; // Add 1 to count if user clicked share and not same ip as last share
  33.  
  34.         if ($get_new_count) {
  35.             if (function_exists("get_" . $network . "_count")) {
  36.                 $network_count = call_user_func("get_" . $network . "_count", $share_url); // 12/17/2018 - Version 1.1 was $count =
  37.  
  38.                 if ($network_count > $last_count || !db_num_rows($result)) // Version 1.1a - Only update count in db if it is bigger than last_count
  39.                     update_count($share_url, $network, $network_count);
  40.             }
  41.         }
  42.         $count = ($network_count > $last_count) ? $network_count : $last_count; // 12/17/2018 - Version 1.1
  43.         if (isset($_POST['click']) && $last_count == $count) $count++; // Add 1 to share count if a user clicked the share button
  44.         if (is_numeric($count))
  45.             $count = add_letter($count);
  46.         echo $network . "=" . $count; // echo to ajax
  47.     }
  48. }  // <----------------------------  THIS
  49. ------------------------------------------------------------------
  50.  
  51. to all the functions of the two files
  52.  
  53. I send to gmail address file icons.zip
  54. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  55. this alternate solution
  56.  
  57.  
  58. # file function.php (for cdn fonts)
  59. <?php
  60.  
  61. /**
  62.  * Font Awesome CDN Setup Webfont
  63.  *
  64.  * This will load Font Awesome from the Font Awesome Free or Pro CDN.
  65.  */
  66. if (! function_exists('fa_custom_setup_cdn_webfont') ) {
  67.     function fa_custom_setup_cdn_webfont($cdn_url = '', $integrity = null) {
  68.         $matches = [];
  69.         $match_result = preg_match('|/([^/]+?)\.css$|', $cdn_url, $matches);
  70.         $resource_handle_uniqueness = ($match_result === 1) ? $matches[1] : md5($cdn_url);
  71.         $resource_handle = "font-awesome-cdn-webfont-$resource_handle_uniqueness";
  72.  
  73.         foreach ( [ 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ] as $action ) {
  74.             add_action(
  75.                 $action,
  76.                 function () use ( $cdn_url, $resource_handle ) {
  77.                     wp_enqueue_style( $resource_handle, $cdn_url, [], null );
  78.                 }
  79.             );
  80.         }
  81.  
  82.         if($integrity) {
  83.             add_filter(
  84.                 'style_loader_tag',
  85.                 function( $html, $handle ) use ( $resource_handle, $integrity ) {
  86.                     if ( in_array( $handle, [ $resource_handle ], true ) ) {
  87.                         return preg_replace(
  88.                             '/\/>$/',
  89.                             'integrity="' . $integrity .
  90.                             '" crossorigin="anonymous" />',
  91.                             $html,
  92.                             1
  93.                         );
  94.                     } else {
  95.                         return $html;
  96.                     }
  97.                 },
  98.                 10,
  99.                 2
  100.             );
  101.         }
  102.     }
  103. }
  104.  
  105. -----------------------------------------------
  106.  
  107. # file index.php (test icons)
  108. <?php include 'include/header.php'; ?>
  109. <body class="bg-light">
  110. <header>
  111.     <div class="container-fluid">
  112.         <div class="container">
  113.             <ul class="list-inline text-primary">
  114.                 <li class="list-inline-item"><i class="fas fa-tty"></i>&nbsp;+971582413208</li>
  115.                 <li class="list-inline-item" style="float: right;"><i class="fab fa-whatsapp"></i>&nbsp;+971556671673</li>
  116.             </ul>
  117.  
  118.  
  119.         </div>
  120.     </div>
  121.     <?php include 'include/navbar.php'; ?>
  122. </header>
  123.  
  124. <div class="container">
  125.  
  126.     <div class="social">
  127.         <p class="skype">
  128.             <a href="#" title="Skype"><i class="fab fa-skype"></i></a>
  129.         </p>
  130.         <p class="facebook">
  131.             <a href="#" title="Facebook"><i class="fab fa-facebook"></i></a>
  132.         </p>
  133.         <p class="twitter">
  134.             <!--<a href="#" title="Twitter"><i class="fab fa-twitter"></i></a>-->
  135.             <a href="https://twitter.com/chiab_gigi?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="false">Follow @chiab_gigi</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
  136.         </p>
  137.         <p class="instagram">
  138.             <a href="#" title="Instagram"><i class="fab fa-instagram"></i></a>
  139.         </p>
  140.         <p class="youtube">
  141.             <a href="#" title="YouTube"><i class="fab fa-youtube"></i></a>
  142.         </p>
  143.         <p class="linkedin">
  144.             <a href="#" title="Linkedin"><i class="fab fa-linkedin-in"></i></a>
  145.         </p>
  146.     </div>
  147.  
  148. </div>
  149.  
  150.  
  151.  
  152. <?php include 'include/footer.php'; ?>
  153.  
  154.  
  155. </body>
  156. </html>
  157. --------------------------------
  158. # file header.php
  159. <?php
  160. include 'functions.php';
  161. ?>
  162. <!DOCTYPE html>
  163. <html lang="en">
  164. <head>
  165.     <meta charset="UTF-8">
  166.     <meta name="author" content="Godwin Ogboe">
  167.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  168.     <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1, shrink-to-fit=no">
  169.     <title><?php echo basename($_SERVER['REQUEST_URI']); ?></title>
  170.     <!-- Latest compiled and minified CSS -->
  171.     <link rel="shortcut icon" href="assets/ico/favicon.ico">
  172.     <link rel="apple-touch-icon" sizes="180x180" href="assets/ico/apple-touch-icon.png">
  173.     <link rel="icon" type="image/png" sizes="32x32" href="assets/ico/favicon-32x32.png">
  174.     <link rel="icon" type="image/png" sizes="16x16" href="assets/ico/favicon-16x16.png">
  175.     <link rel="manifest" href="assets/ico/site.webmanifest">
  176.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  177.     <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
  178.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-social/5.1.1/bootstrap-social.min.css">
  179.     <link rel="stylesheet" href="assets/css/style.css">
  180.     <!--<link rel="stylesheet" href="assets/css/coolsocial.css">-->
  181.     <style>
  182.         .social {
  183.             line-height: 200px;
  184.             height: 200px;
  185.             text-align: center;
  186.         }
  187.  
  188.         .social p {
  189.             line-height: 1.5;
  190.             display: inline-block;
  191.             vertical-align: middle;
  192.         }
  193.     </style>
  194.  
  195. </head>
  196. -------------------------------
  197. #file footer.php
  198. <footer>
  199.     <div class="col-md-12 justify-content-center">
  200.  
  201.  
  202.         <p style="font-size: 11px; text-align: center;">Copyright &copy;  2020 - <?php echo date('Y');?> Ifeanyi Chukwu Automobile. All Right Reserved </p>
  203.     </div>
  204.     <div class="social">
  205.         <p class="skype">
  206.             <a href="#" title="Skype"><i class="fab fa-skype"></i></a>
  207.         </p>
  208.         <p class="facebook">
  209.             <a href="#" title="Facebook"><i class="fab fa-facebook"></i></a>
  210.         </p>
  211.         <p class="twitter">
  212.             <!--<a href="#" title="Twitter"><i class="fab fa-twitter"></i></a>-->
  213.             <a href="https://twitter.com/chiab_gigi?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="false">Follow @chiab_gigi</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
  214.         </p>
  215.         <p class="instagram">
  216.             <a href="#" title="Instagram"><i class="fab fa-instagram"></i></a>
  217.         </p>
  218.         <p class="youtube">
  219.             <a href="#" title="YouTube"><i class="fab fa-youtube"></i></a>
  220.         </p>
  221.         <p class="linkedin">
  222.             <a href="#" title="Linkedin"><i class="fab fa-linkedin-in"></i></a>
  223.         </p>
  224.     </div>
  225.  
  226. </footer>
  227.  
  228. <!-- jQuery library -->
  229. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  230.  
  231. <!-- Popper JS -->
  232. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  233.  
  234. <!-- Latest compiled JavaScript -->
  235. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
  236.  
  237. <!-- Font Awesome JS -->
  238. <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/solid.js" integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"></script>
  239. <script defer src="https://use.fontawesome.com/releases/v5.0.13/js/fontawesome.js" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
  240. <script src="https://kit.fontawesome.com/e04e8f81b0.js"></script>
  241. <script src="//cdn.ckeditor.com/4.16.0/standard/ckeditor.js"></script>
  242. <!--<script>
  243.     CKEDITOR.replace( 'descs' );
  244. </script>-->
  245. -------------------------------
  246.  
  247.  
  248.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement