PluginProbe ʕ •ᴥ•ʔ
پارسی دیت – Parsi Date / 5.1.2
پارسی دیت – Parsi Date v5.1.2
6.2 6.1 5.1.6 5.1.7 5.1.8 5.1.8.2 6.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.0.0-alpha 2.1 2.1.1 2.1.2 2.1.3 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0.1 2.3.0.2 2.3.1 2.3.2 2.3.3 2.3.4 3.0.1 3.0.2 3.0.3 4.0.0 4.0.1 4.0.2 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5
wp-parsidate / includes / tools.php
wp-parsidate / includes Last commit date
admin 1 year ago plugins 1 year ago views 1 year ago widget 1 year ago fixes-archive.php 1 year ago fixes-archives.php 1 year ago fixes-calendar.php 1 year ago fixes-dates.php 1 year ago fixes-misc.php 1 year ago fixes-permalinks.php 1 year ago general.php 1 year ago install.php 1 year ago parsidate.php 1 year ago settings.php 1 year ago tools.php 1 year ago
tools.php
86 lines
1 <?php
2
3 defined( 'ABSPATH' ) or exit( 'No direct script access allowed' );
4
5 /**
6 * WP-Parsidate Tools
7 *
8 * @author HamidReza Yazdani
9 * @sicne 5.1.0
10 */
11
12 if ( wpp_is_active( 'date_in_admin_bar' ) ) {
13
14 if ( ! function_exists( 'wpp_add_date_to_admin_bar' ) ) {
15 /**
16 * Add Jalali date to WordPress admin bar
17 *
18 * @param $wp_admin_bar
19 *
20 * @return void
21 */
22 function wpp_add_date_to_admin_bar( $wp_admin_bar ) {
23 $current_date = parsidate( 'l Y/m/d', date( 'Y-m-d' ) );
24
25 $args = array(
26 'id' => 'wpp_current_date',
27 'title' => esc_html__( 'Today:&nbsp;', 'wp-parsidate' ) . $current_date,
28 'meta' => array( 'class' => 'wpp-admin-bar-date' ),
29 );
30
31 $wp_admin_bar->add_node( $args );
32 }
33
34 add_action( 'admin_bar_menu', 'wpp_add_date_to_admin_bar', PHP_INT_MAX );
35 }
36
37 /**
38 * Style Wp-Parsidate admin bar date
39 */
40 if ( ! function_exists( 'wpp_admin_bar_date_style' ) ) {
41 function wpp_admin_bar_date_style( $wp_admin_bar ) {
42 echo '<style>
43 .wpp-admin-bar-date {
44 color: #fff;
45 background-color: var(--e-context-primary-color) !important;
46 border-radius: 5px 5px 0 0 !important;
47 unicode-bidi: embed !important;
48 }
49 </style>';
50 }
51
52 add_action( 'admin_head', 'wpp_admin_bar_date_style' );
53 }
54 }
55
56 if ( wpp_is_active( 'disable_copy' ) ) {
57 if ( ! function_exists( 'wpp_disable_copy' ) ) {
58 function wpp_disable_copy() {
59 echo '<script>
60 document.addEventListener("DOMContentLoaded", (event) => {
61 document.body.onselectstart = () => false;
62 document.body.oncopy = (e) => {
63 e.preventDefault();
64 return false;
65 };
66 });
67 </script>';
68 }
69
70 add_action( 'wp_footer', 'wpp_disable_copy' );
71 }
72 }
73
74 if ( wpp_is_active( 'disable_right_click' ) ) {
75 if ( ! function_exists( 'wpp_disable_right_click' ) ) {
76 function wpp_disable_right_click() {
77 echo '<script>
78 document.addEventListener("contextmenu", function(e) {
79 e.preventDefault();
80 });
81 </script>';
82 }
83
84 add_action( 'wp_footer', 'wpp_disable_right_click' );
85 }
86 }