| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/mahyarcake/./public_html/wp-content/plugins/wp-parsidate/includes/admin/ |
Upload File : |
<?php
defined( 'ABSPATH' ) or exit( 'No direct script access allowed' );
/**
* Fixes admin lists for dates
*
* @author Mobin Ghasempoor
* @package WP-Parsidate
* @subpackage Admin/Lists
*/
/**
* Enqueues admin scripts
*
* @return void
* @author Ehsaan
*/
function wpp_enqueue_admin_scripts() {
wp_register_script( 'wpp_admin', WP_PARSI_URL . 'assets/js/admin.js', false, WP_PARSI_VER );
wp_enqueue_script( 'wpp_admin' );
}
add_action( 'admin_enqueue_scripts', 'wpp_enqueue_admin_scripts' );
/**
* Hooks admin functions for restrict posts in edit pages
*
* @return void
*/
function wpp_backend_init() {
add_action( 'restrict_manage_posts', 'wpp_restrict_posts' );
add_filter( 'posts_where', 'wpp_admin_posts_where' );
}
add_action( 'load-edit.php', 'wpp_backend_init' );
/**
* Limits posts to a certain date, if date setted
*
* @param string $where Query pointer
*
* @return string New Pointer
*/
function wpp_admin_posts_where( $where ) {
global $wp_query;
if ( isset( $_GET['mfa'] ) && $_GET['mfa'] != '0' ) {
$wp_query->query_vars['m'] = $_GET['mfa'];
$where = wpp_posts_where( $where, $wp_query );
}
return $where;
}
/**
* Restrict posts to given date
* @return void
* @author Parsa Kafi
* @author Mobin Ghasempoor
*/
function wpp_restrict_posts() {
global $post_type, $post_status, $wpdb, $persian_month_names;
$post_status_w = "AND post_status <> 'auto-draft'";
if ( $post_status != "" ) {
if ( is_string( $post_status ) ) {
$post_status_w .= " AND post_status = '$post_status'";
}
} else {
$post_status_w .= " AND post_status <> 'trash'";
}
$sql = "SELECT DISTINCT date( post_date ) AS date
FROM $wpdb->posts
WHERE post_type='$post_type' $post_status_w AND date( post_date ) <> '0000-00-00'
ORDER BY post_date";
$list = $wpdb->get_col( $sql );
if ( empty( $list ) ) {
return;
}
$m = isset( $_GET['mfa'] ) ? (int) $_GET['mfa'] : 0;
$predate = '';
echo '<select name="mfa">';
echo '<option ' . selected( $m, 0, false ) . ' value="0">' . __( 'Show All Dates', 'wp-parsidate' ) . '</option>' . PHP_EOL;
foreach ( $list as $date ) {
$date = parsidate( 'Ym', $date, 'eng' );
$year = substr( $date, 0, 4 );
$month = substr( $date, 4, 2 );
$month = $persian_month_names[ intval( $month ) ];
if ( $predate != $date ) {
echo sprintf( '<option %s value="%s">%s</option>', selected( $m, $date, false ), $date, $month . ' ' . fix_number( $year ) );
}
$predate = $date;
}
echo '</select>';
}