Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.72 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP7 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 4.0.8.9
  8. * @ Author : DeZender
  9. * @ Release on : 10.05.2019
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function pinc_after_setup_theme()
  15. {
  16. load_theme_textdomain('pinc', get_template_directory() . '/languages');
  17. register_nav_menus(['top_nav' => 'Top Navigation']);
  18. add_theme_support('automatic-feed-links');
  19. add_theme_support('post-thumbnails');
  20. add_theme_support('custom-background', ['default-color' => 'f2f2f2']);
  21. add_editor_style();
  22. show_admin_bar(false);
  23. remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
  24. remove_action('wp_head', 'wp_generator');
  25. remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
  26. add_image_size('board-main-image', 338, 200, ['center', 'center']);
  27. }
  28.  
  29. function pinc_widgets_init()
  30. {
  31. register_sidebar(['id' => 'sidebar-r-t', 'name' => 'Right Sidebar for Single Pins Only (Above Boards)', 'before_widget' => '<div class="sidebar-wrapper"><div class="sidebar-inner">', 'after_widget' => '</div></div>', 'before_title' => '<h4>', 'after_title' => '</h4>']);
  32. register_sidebar(['id' => 'sidebar-r', 'name' => 'Right Sidebar for Single Pins Only (Below Boards)', 'before_widget' => '<div class="sidebar-wrapper"><div class="sidebar-inner">', 'after_widget' => '</div></div>', 'before_title' => '<h4>', 'after_title' => '</h4>']);
  33. register_sidebar(['id' => 'sidebar-others', 'name' => 'Right Sidebar for Other Pages & Sideblog', 'before_widget' => '<div class="sidebar-wrapper"><div class="sidebar-inner">', 'after_widget' => '</div></div>', 'before_title' => '<h4>', 'after_title' => '</h4>']);
  34. }
  35.  
  36. function pinc_head()
  37. {
  38. if (is_single()) {
  39. global $post;
  40. setup_postdata($post);
  41. $output = '<meta property="og:type" content="article" />' . "\n";
  42. $output .= '<meta property="og:title" content="' . preg_replace('/[\\n\\r]/', ' ', mb_strimwidth(the_title_attribute('echo=0'), 0, 255, ' ...')) . '" />' . "\n";
  43. $output .= '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
  44.  
  45. if ($post->post_content == '') {
  46. $meta_categories = get_the_category($post->ID);
  47.  
  48. foreach ($meta_categories as $meta_category) {
  49. $meta_category_name = $meta_category->name;
  50. }
  51.  
  52. if (pinc_get_post_board()) {
  53. $meta_board_name = pinc_get_post_board()->name;
  54. }
  55. else {
  56. $meta_board_name = __('Untitled', 'pinc');
  57. }
  58.  
  59. $output .= '<meta property="og:description" content="' . esc_attr(__('Pinned onto', 'pinc') . ' ' . $meta_board_name . __('Board in', 'pinc') . ' ' . $meta_category_name . ' ' . __('Category', 'pinc')) . '" />' . "\n";
  60. }
  61. else {
  62. $output .= '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
  63. }
  64.  
  65. if (has_post_thumbnail()) {
  66. $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
  67. $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
  68. }
  69.  
  70. if (get_option('wsl_settings_Facebook_app_id')) {
  71. $output .= '<meta property="fb:app_id" content="' . get_option('wsl_settings_Facebook_app_id') . '" />' . "\n";
  72. }
  73.  
  74. echo $output;
  75. }
  76.  
  77. if (is_tax('board')) {
  78. global $post;
  79. global $wp_query;
  80. global $wp_taxonomies;
  81. setup_postdata($post);
  82. $output = '<meta property="og:type" content="article" />' . "\n";
  83. $output .= '<meta property="og:title" content="' . esc_attr($wp_query->queried_object->name) . '" />' . "\n";
  84. $output .= '<meta property="og:url" content="' . home_url('/' . $wp_taxonomies['board']->rewrite['slug'] . '/' . sanitize_title($wp_query->queried_object->name, '_') . '/') . $wp_query->queried_object->term_id . '/" />' . "\n";
  85. $output .= '<meta property="og:description" content="" />' . "\n";
  86.  
  87. if (has_post_thumbnail()) {
  88. $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
  89. $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
  90. }
  91.  
  92. echo $output;
  93. }
  94.  
  95. if (is_author()) {
  96. global $wp_query;
  97. global $wp_rewrite;
  98. $user_info = get_user_by('id', $wp_query->query_vars['author']);
  99. $output = '<meta property="og:type" content="article" />' . "\n";
  100. $output .= '<meta property="og:title" content="' . esc_attr($user_info->display_name) . ' (' . $user_info->user_nicename . ')" />' . "\n";
  101. $output .= '<meta property="og:url" content="' . home_url('/') . $wp_rewrite->author_base . '/' . $user_info->user_nicename . '/" />' . "\n";
  102. $output .= '<meta property="og:description" content="' . esc_attr($user_info->description) . '" />' . "\n";
  103. $avatar_id = get_user_meta($user_info->ID, 'pinc_user_avatar', true);
  104. if (($avatar_id != '') && ($avatar_id != 'deleted')) {
  105. $user_avatar = wp_get_attachment_image_src($avatar_id, 'full');
  106. $output .= '<meta property="og:image" content="' . $user_avatar[0] . '" />' . "\n";
  107. }
  108.  
  109. echo $output;
  110. }
  111. }
  112.  
  113. function pinc_post_class($classes)
  114. {
  115. $classes = array_diff($classes, ['hentry']);
  116. return $classes;
  117. }
  118.  
  119. function pinc_query_vars($aVars)
  120. {
  121. $aVars[] = 'domain';
  122. $aVars[] = 'sort';
  123. $aVars[] = 'minprice';
  124. $aVars[] = 'maxprice';
  125. return $aVars;
  126. }
  127.  
  128. function pinc_rewrite_rules_array($aRules)
  129. {
  130. $aNewRules = ['source/([^/]+)/?$' => 'index.php?pagename=source&domain=$matches[1]'];
  131. $aRules = $aNewRules + $aRules;
  132. return $aRules;
  133. }
  134.  
  135. function pinc_wp()
  136. {
  137. if (is_page('source')) {
  138. remove_action('wp_head', 'rel_canonical');
  139. }
  140. }
  141.  
  142. function pinc_wp_title($title, $sep)
  143. {
  144. if (is_tax('board')) {
  145. global $post;
  146. $user_info = get_user_by('id', $post->post_author);
  147. return str_replace(' Boards', '', $title) . ' ' . __('Board by', 'pinc') . ' ' . $user_info->display_name;
  148. }
  149.  
  150. if (is_page('source')) {
  151. global $wp_query;
  152. return __('Pins from', 'pinc') . ' ' . $wp_query->query_vars['domain'] . str_replace('Source ', ' ', $title);
  153. }
  154.  
  155. if (is_single()) {
  156. if (70 < mb_strlen($title)) {
  157. $title = mb_strimwidth($title, 0, 70, ' ...');
  158. }
  159. }
  160.  
  161. if (is_author()) {
  162. global $wp_query;
  163. $title = $title . '(' . $wp_query->queried_object->data->user_nicename . ')';
  164. }
  165.  
  166. if (is_tag()) {
  167. $title = __('Tag:', 'pinc') . ' ' . $title;
  168. }
  169.  
  170. if (is_category()) {
  171. $title = __('Category:', 'pinc') . ' ' . $title;
  172. }
  173.  
  174. if (is_search()) {
  175. return __('Search results for', 'pinc') . ' ' . get_search_query();
  176. }
  177.  
  178. return $title;
  179. }
  180.  
  181. function pinc_admin_init()
  182. {
  183. if ((!defined('DOING_AJAX') || !DOING_AJAX) && !current_user_can('administrator') && !current_user_can('editor')) {
  184. wp_redirect(home_url());
  185. exit();
  186. }
  187. }
  188.  
  189. function pinc_login_init()
  190. {
  191. if (!isset($_REQUEST) || empty($_REQUEST) || ($_GET['action'] == 'register')) {
  192. ..................................................
  193. .....................
  194. ........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement