Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by http://DeZender.Net
- * @ deZender (PHP7 Decoder for ionCube Encoder)
- *
- * @ Version : 4.0.8.9
- * @ Author : DeZender
- * @ Release on : 10.05.2019
- * @ Official site : http://DeZender.Net
- *
- */
- function pinc_after_setup_theme()
- {
- load_theme_textdomain('pinc', get_template_directory() . '/languages');
- register_nav_menus(['top_nav' => 'Top Navigation']);
- add_theme_support('automatic-feed-links');
- add_theme_support('post-thumbnails');
- add_theme_support('custom-background', ['default-color' => 'f2f2f2']);
- add_editor_style();
- show_admin_bar(false);
- remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
- remove_action('wp_head', 'wp_generator');
- remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
- add_image_size('board-main-image', 338, 200, ['center', 'center']);
- }
- function pinc_widgets_init()
- {
- 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>']);
- 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>']);
- 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>']);
- }
- function pinc_head()
- {
- if (is_single()) {
- global $post;
- setup_postdata($post);
- $output = '<meta property="og:type" content="article" />' . "\n";
- $output .= '<meta property="og:title" content="' . preg_replace('/[\\n\\r]/', ' ', mb_strimwidth(the_title_attribute('echo=0'), 0, 255, ' ...')) . '" />' . "\n";
- $output .= '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
- if ($post->post_content == '') {
- $meta_categories = get_the_category($post->ID);
- foreach ($meta_categories as $meta_category) {
- $meta_category_name = $meta_category->name;
- }
- if (pinc_get_post_board()) {
- $meta_board_name = pinc_get_post_board()->name;
- }
- else {
- $meta_board_name = __('Untitled', 'pinc');
- }
- $output .= '<meta property="og:description" content="' . esc_attr(__('Pinned onto', 'pinc') . ' ' . $meta_board_name . __('Board in', 'pinc') . ' ' . $meta_category_name . ' ' . __('Category', 'pinc')) . '" />' . "\n";
- }
- else {
- $output .= '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
- }
- if (has_post_thumbnail()) {
- $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
- $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
- }
- if (get_option('wsl_settings_Facebook_app_id')) {
- $output .= '<meta property="fb:app_id" content="' . get_option('wsl_settings_Facebook_app_id') . '" />' . "\n";
- }
- echo $output;
- }
- if (is_tax('board')) {
- global $post;
- global $wp_query;
- global $wp_taxonomies;
- setup_postdata($post);
- $output = '<meta property="og:type" content="article" />' . "\n";
- $output .= '<meta property="og:title" content="' . esc_attr($wp_query->queried_object->name) . '" />' . "\n";
- $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";
- $output .= '<meta property="og:description" content="" />' . "\n";
- if (has_post_thumbnail()) {
- $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
- $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
- }
- echo $output;
- }
- if (is_author()) {
- global $wp_query;
- global $wp_rewrite;
- $user_info = get_user_by('id', $wp_query->query_vars['author']);
- $output = '<meta property="og:type" content="article" />' . "\n";
- $output .= '<meta property="og:title" content="' . esc_attr($user_info->display_name) . ' (' . $user_info->user_nicename . ')" />' . "\n";
- $output .= '<meta property="og:url" content="' . home_url('/') . $wp_rewrite->author_base . '/' . $user_info->user_nicename . '/" />' . "\n";
- $output .= '<meta property="og:description" content="' . esc_attr($user_info->description) . '" />' . "\n";
- $avatar_id = get_user_meta($user_info->ID, 'pinc_user_avatar', true);
- if (($avatar_id != '') && ($avatar_id != 'deleted')) {
- $user_avatar = wp_get_attachment_image_src($avatar_id, 'full');
- $output .= '<meta property="og:image" content="' . $user_avatar[0] . '" />' . "\n";
- }
- echo $output;
- }
- }
- function pinc_post_class($classes)
- {
- $classes = array_diff($classes, ['hentry']);
- return $classes;
- }
- function pinc_query_vars($aVars)
- {
- $aVars[] = 'domain';
- $aVars[] = 'sort';
- $aVars[] = 'minprice';
- $aVars[] = 'maxprice';
- return $aVars;
- }
- function pinc_rewrite_rules_array($aRules)
- {
- $aNewRules = ['source/([^/]+)/?$' => 'index.php?pagename=source&domain=$matches[1]'];
- $aRules = $aNewRules + $aRules;
- return $aRules;
- }
- function pinc_wp()
- {
- if (is_page('source')) {
- remove_action('wp_head', 'rel_canonical');
- }
- }
- function pinc_wp_title($title, $sep)
- {
- if (is_tax('board')) {
- global $post;
- $user_info = get_user_by('id', $post->post_author);
- return str_replace(' Boards', '', $title) . ' ' . __('Board by', 'pinc') . ' ' . $user_info->display_name;
- }
- if (is_page('source')) {
- global $wp_query;
- return __('Pins from', 'pinc') . ' ' . $wp_query->query_vars['domain'] . str_replace('Source ', ' ', $title);
- }
- if (is_single()) {
- if (70 < mb_strlen($title)) {
- $title = mb_strimwidth($title, 0, 70, ' ...');
- }
- }
- if (is_author()) {
- global $wp_query;
- $title = $title . '(' . $wp_query->queried_object->data->user_nicename . ')';
- }
- if (is_tag()) {
- $title = __('Tag:', 'pinc') . ' ' . $title;
- }
- if (is_category()) {
- $title = __('Category:', 'pinc') . ' ' . $title;
- }
- if (is_search()) {
- return __('Search results for', 'pinc') . ' ' . get_search_query();
- }
- return $title;
- }
- function pinc_admin_init()
- {
- if ((!defined('DOING_AJAX') || !DOING_AJAX) && !current_user_can('administrator') && !current_user_can('editor')) {
- wp_redirect(home_url());
- exit();
- }
- }
- function pinc_login_init()
- {
- if (!isset($_REQUEST) || empty($_REQUEST) || ($_GET['action'] == 'register')) {
- wp_redirect(home_url());
- exit();
- }
- }
- function pinc_login_url($login_url, $redirect)
- {
- $login_url = home_url('/login/');
- if (!empty($redirect)) {
- $duplicate_redirect = substr_count($redirect, 'redirect_to');
- .............................................................................
- .........................................
- .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement