Plugin Directory

Changeset 3132579


Ignore:
Timestamp:
08/08/2024 09:34:58 AM (18 months ago)
Author:
brainvireinfo
Message:

updating plugin with latest WP version

Location:
search-clickable-phone-number-for-mobile-device
Files:
8 added
3 edited

Legend:

Unmodified
Added
Removed
  • search-clickable-phone-number-for-mobile-device/trunk/phone-number-search-form.php

    r1441664 r3132579  
    11<?php
    2 if ( !function_exists( 'spnrp_search_phone_number' ) ) {
    3 
    4     // Search function for phone number
    5     function spnrp_search_phone_number() {
    6         global $wpdb;
    7 
    8         $spnrp_tbl_name = '';
    9         $spnrp_tbl_field = '';
    10         $spnrp_order_column = '';
    11         $spnrp_field = '';
    12         $spnrp_order = '';
    13         $spnrp_post_table_name = $wpdb->prefix . 'posts';
    14         $spnrp_comment_table_name = $wpdb->prefix . 'comments';
    15         ?>
    16         <div class="wrap nosubsub">
    17             <h1><?php echo __( 'Phone Numbers' ); ?></h1>
    18             <div id="ajax-response"></div>
    19             <br class="clear">
    20 
    21             <div id="col-container">
    22                 <?php
    23                 if ( isset( $_POST['spnrp_submit'] ) && !empty( $_POST['spnrp_submit'] ) &&
    24                     wp_verify_nonce( $_POST['spnrp_form_security'], 'spnrp-form-security' ) &&
    25                     isset( $_POST['spnrp_select_field'] ) && !empty( $_POST['spnrp_select_field'] ) &&
    26                     isset( $_POST['spnrp_select_order'] ) && !empty( $_POST['spnrp_select_order'] ) ) {
    27 
    28                     $spnrp_field = sanitize_text_field( $_POST['spnrp_select_field'] );
    29                     $spnrp_order = sanitize_text_field( $_POST['spnrp_select_order'] );
    30 
    31                     switch ( $spnrp_field ) {
    32 
    33                         case 'post_content':
    34                             $spnrp_tbl_name = $spnrp_post_table_name;
    35                             $spnrp_tbl_field = "post_status = 'publish'";
    36                             $spnrp_order_column = "post_date $spnrp_order";
    37                             break;
    38                         case 'post_excerpt':
    39                             $spnrp_tbl_name = $spnrp_post_table_name;
    40                             $spnrp_tbl_field = "post_status = 'publish'";
    41                             $spnrp_order_column = "post_date $spnrp_order";
    42                             break;
    43                         case 'comment_content':
    44                             $spnrp_tbl_name = $spnrp_comment_table_name;
    45                             $spnrp_tbl_field = "comment_approved = true";
    46                             $spnrp_order_column = "comment_date $spnrp_order";
    47                             break;                   
    48                     }
    49                     ?>
    50                     <div id="col-right">
    51                         <div class="col-wrap">
    52                             <h2 class="screen-reader-text"><?php echo  __( 'Phone number list' ); ?></h2>
    53                             <table class="wp-list-table widefat fixed striped tags">
    54                                 <thead>
    55                                     <tr>
    56                                         <th scope="col" id="spnrp_title" class="manage-column column-spnrp-title column-primary">
    57                                             <span><?php echo  __( 'Title' ); ?></span>
    58                                         </th>
    59                                         <th scope="col" id="spnrp_type" class="manage-column column-spnrp-type">
    60                                             <span><?php echo  __( 'Type' ); ?></span>
    61 
    62                                         </th>
    63                                         <th scope="col" id="spnrp_pnumber" class="manage-column column-spnrp-pnumber">
    64                                             <span><?php echo  __( 'Phone numbers' ); ?></span>
    65                                         </th>
    66                                         <th scope="col" id="spnrp_status" class="manage-column column-spnrp-status">
    67                                             <span><?php echo  __( 'Status - Clickable' ); ?></span>
    68                                         </th>
    69                                     </tr>
    70                                 </thead>
    71                                 <tbody id="the-list" data-wp-lists="list:tag">
    72                                     <?php
    73                                     $spnrp_sql = "SELECT * FROM $spnrp_tbl_name WHERE $spnrp_tbl_field ORDER BY $spnrp_order_column";
    74                                     $spnrp_results = $wpdb->get_results( $spnrp_sql );
    75 
    76                                     if ( count( $spnrp_results ) > 0 ) {
    77                                         $spnrp_count = 0;
    78                                         foreach ( $spnrp_results as $check ) {
    79 
    80                                             $spnrp_found_yes = '';
    81                                             $spnrp_found_no = '';
    82                                             $spnrp_col = '';
    83                                             $spnrp_title = '';
    84                                             $spnrp_type = '';
    85                                             $spnrp_id = '';
    86                                             $spnrp_edit_link = '';
    87 
    88                                             if ( $spnrp_tbl_name == $wpdb->prefix . "posts" && $spnrp_field == "post_content" ) {
    89                                                 $spnrp_col = $check->post_content;
    90                                                 $spnrp_title = $check->post_title;
    91                                                 $spnrp_type = $check->post_type;
    92                                                 $spnrp_id = $check->ID;
    93                                                 $spnrp_edit_link = admin_url( 'post.php?post=' . $check->ID . '&action=edit' );
    94                                             }
    95 
    96                                             if ( $spnrp_tbl_name == $wpdb->prefix . "posts" && $spnrp_field == "post_excerpt" ) {
    97                                                 $spnrp_col = $check->post_excerpt;
    98                                                 $spnrp_title = $check->post_title;
    99                                                 $spnrp_type = $check->post_type;
    100                                                 $spnrp_id = $check->ID;
    101                                                 $spnrp_edit_link = admin_url( 'post.php?post=' . $check->ID . '&action=edit' );
    102                                             }
    103 
    104                                             if ( $spnrp_tbl_name == $wpdb->prefix . "comments" && $spnrp_field == "comment_content" ) {
    105                                                 $spnrp_col = $check->comment_content;
    106                                                 $spnrp_title = get_the_title($check->comment_post_ID);
    107                                                 $spnrp_type = get_comment_type( $check->comment_ID );
    108                                                 $spnrp_id = $check->comment_ID;
    109                                                 $spnrp_edit_link = admin_url( 'comment.php?action=editcomment&c='.$check->comment_ID );
    110                                             }
    111 
    112                                             if ( preg_match_all( "/\+{0,1}[0-9]{0,2}[ .-]*\(*[0-9]{3}\)*[ .-]*[0-9]{3}[ .-]*[0-9]{4}/", strip_tags( $spnrp_col ), $matches ) ) {
    113 
    114                                                 foreach ( $matches[0] as $key => $value ) {
    115 
    116                                                     if ( preg_match_all( "/\<a\shref\s*=\s*[\" | \']tel:\+{0,1}\d*[\" | \']\>\s*" . $value . "\s*\<\/a\>/", $spnrp_col, $mat ) ) {
    117                                                         $spnrp_found_yes .= $value . ",<br>";
    118                                                     } else {
    119                                                         $spnrp_found_no .= $value . ",<br>";
    120                                                     }
    121                                                 }
    122                                             }
    123                                             if ( $spnrp_found_yes ) { ?>
    124                                                 <tr id="tag-1">
    125                                                     <td class="name column-name has-row-actions column-primary">
    126                                                         <strong>
    127                                                             <a class="row-title" href="<?php echo $spnrp_edit_link; ?>">
    128                                                                 <?php echo $spnrp_title; ?>
    129                                                             </a>
    130                                                         </strong>
    131                                                         <br>
    132                                                         <div class="row-actions">
    133                                                             <span class="edit"><a href="<?php echo $spnrp_edit_link; ?>">Edit</a> | </span>
    134                                                             <span class="view"><a href="<?php the_permalink( $spnrp_id ); ?>"> View </a></span>
    135                                                         </div>
    136                                                     </td>
    137                                                     <td class="column-description">
    138                                                         <p><?php echo $spnrp_type; ?></p>
    139                                                     </td>
    140                                                     <td class="column-spnrp-type">
    141                                                         <?php echo rtrim( $spnrp_found_yes, ',<br>' ); ?>
    142                                                     </td>
    143                                                     <td class="column-spnrp-status">
    144                                                         <span style="color: #01a252">Yes</span>
    145                                                     </td>
    146                                                 </tr>
    147                                             <?php 
    148                                                 $spnrp_count++;
    149                                             }
    150                                             if ( $spnrp_found_no ) { ?>
    151                                                 <tr id="tag-1">
    152                                                     <td class="name column-name has-row-actions column-primary" data-colname="Name">
    153                                                         <strong>
    154                                                             <a class="row-title" href="<?php echo $spnrp_edit_link; ?>"><?php echo $spnrp_title; ?></a>
    155                                                         </strong>
    156                                                         <br>
    157                                                         <div class="row-actions">
    158                                                             <span class="edit"><a href="<?php echo $spnrp_edit_link; ?>" >Edit</a> | </span>
    159                                                             <span class="view"><a href="<?php the_permalink( $spnrp_id ); ?>" >View</a></span>
    160                                                         </div>
    161                                                     </td>
    162                                                     <td class="column-spnrp-type">
    163                                                         <p><?php echo $spnrp_type; ?></p>
    164                                                     </td>
    165                                                     <td class="column-spnrp-pnumber">
    166                                                         <?php echo rtrim( $spnrp_found_no, ',<br>' ); ?>
    167                                                     </td>
    168                                                     <td class="column-spnrp-status">
    169                                                         <span style="color: #F30">No</span>
    170                                                     </td>
    171                                                 </tr>
    172                                             <?php
    173                                                 $spnrp_count++;
    174                                             }
    175                                         }
    176                                         if( $spnrp_count < 0 ) { ?>
    177                                             <tr class='no-items'>
    178                                                 <td class='colspanchange' colspan='4'>No results found.</td>
    179                                             </tr>
    180                                         <?php }
    181 
    182                                     } else { ?>
    183                                         <tr class='no-items'>
    184                                             <td class='colspanchange' colspan='4'>No results found.</td>
    185                                         </tr>
    186                                     <?php } ?>
    187                                 </tbody>
    188                                 <tfoot>
    189                                     <tr>
    190                                         <th scope="col" id="spnrp_title" class="manage-column column-spnrp-title column-primary">
    191                                             <span><?php echo  __( 'Title' ); ?></span>
    192                                         </th>
    193                                         <th scope="col" id="spnrp_type" class="manage-column column-spnrp-type">
    194                                             <span><?php echo  __( 'Type' ); ?></span>
    195                                         </th>
    196                                         <th scope="col" id="spnrp_pnumber" class="manage-column column-spnrp-pnumber">
    197                                             <span><?php echo  __( 'Phone numbers' ); ?></span>
    198                                         </th>
    199                                         <th scope="col" id="spnrp_status" class="manage-column column-spnrp-status">
    200                                             <span><?php echo  __( 'Status - Clickable' ); ?></span>
    201                                         </th>
    202                                     </tr>
    203                                 </tfoot>
    204                             </table>
    205                         </div>
    206                     </div><!-- /col-right -->
    207                 <?php
    208                 }
    209                 ?>
    210                 <div id="col-left">
    211                     <div class="col-wrap">
    212                         <div class="form-wrap">
    213                             <h2>Search Clickable Phone Number</h2>
    214                             <form name="spnrp_form" id="spnrp_from" method="POST" action="">
    215                                 <div class="form-field term-parent-wrap">
    216                                     <label for="parent"><?php _e('Field'); ?></label>
    217                                     <select name="spnrp_select_field" id="spnrp_select_field" class="postform">
    218                                         <option value="post_content" <?php echo ($spnrp_field == 'post_content')? "selected" : ""; ?> >Post Content</option>
    219                                         <option value="post_excerpt" <?php echo ($spnrp_field == 'post_excerpt')? "selected" : ""; ?> >Post Excerpt</option>
    220                                         <option value="comment_content" <?php echo ($spnrp_field == 'comment_content')? "selected" : ""; ?> >Comment Content</option>
    221                                     </select>
    222                                     <p>Select a field from you need to search phone number.</p>
    223                                 </div>
    224                                 <div class="form-field term-parent-wrap">
    225                                     <label for="parent"><?php _e('Order'); ?></label>
    226                                     <select name="spnrp_select_order" id="spnrp_select_order">
    227                                         <option value="ASC" <?php echo ($spnrp_order == 'ASC')? "selected" : ""; ?> >Ascending</option>
    228                                         <option value="DESC" <?php echo ($spnrp_order == 'DESC')? "selected" : ""; ?> >Descending</option>
    229                                     </select>
    230                                     <p>Select order in which you need to list search result.</p>
    231                                 </div>
    232                                 <p class="submit">
    233                                     <?php wp_nonce_field('spnrp-form-security', 'spnrp_form_security'); ?>
    234                                     <input type="submit" name="spnrp_submit" id="spnrp_submit" class="button button-primary" value="Search">
    235                                 </p>
    236                             </form>
    237                         </div>
    238                     </div><!-- /col-left -->
    239                 </div><!-- /col-container -->
    240             </div>
    241         </div>
    242         <?php
    243     }
     2/**
     3 * This file contains the functions related to searching phone numbers.
     4 *
     5 * @package    MyPhoneNumberPlugin
     6 * @subpackage Admin
     7 * @category   Functions
     8 * @since      1.0.0
     9 */
     10
     11if ( ! function_exists( 'spnrp_search_phone_number' ) ) {
     12    /**
     13     * Search function for phone number.
     14     *
     15     * This function searches phone numbers in post content, post excerpt,
     16     * and comment content and displays the results in a table.
     17     *
     18     * @global wpdb $wpdb WordPress database abstraction object.
     19     */
     20    function spnrp_search_phone_number() {
     21        global $wpdb;
     22
     23        $spnrp_tbl_name = '';
     24        $spnrp_field = '';
     25        $spnrp_order = '';
     26        $spnrp_post_table_name = $wpdb->prefix . 'posts';
     27        $spnrp_comment_table_name = $wpdb->prefix . 'comments';
     28        ?>
     29        <div class="wrap nosubsub">
     30        <h1><?php echo esc_html( 'Phone Numbers' ); ?></h1>
     31        <div id="ajax-response"></div>
     32        <br class="clear">
     33
     34        <div id="col-container">
     35            <?php
     36            if ( isset( $_POST['spnrp_submit'], $_POST['spnrp_form_security'], $_POST['spnrp_select_field'], $_POST['spnrp_select_order'] ) &&
     37            ! empty( $_POST['spnrp_submit'] ) &&
     38            wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['spnrp_form_security'] ) ), 'spnrp-form-security' ) &&
     39            ! empty( $_POST['spnrp_select_field'] ) &&
     40            ! empty( $_POST['spnrp_select_order'] ) ) {
     41
     42                $spnrp_field = sanitize_text_field( wp_unslash( $_POST['spnrp_select_field'] ) );
     43                $spnrp_order = sanitize_text_field( wp_unslash( $_POST['spnrp_select_order'] ) );
     44
     45                switch ( $spnrp_field ) {
     46                    case 'post_content':
     47                    case 'post_excerpt':
     48                        $spnrp_tbl_name = $spnrp_post_table_name;
     49                        $spnrp_results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM %1s WHERE post_status = 'publish' ORDER BY post_date %2s", $spnrp_post_table_name, $spnrp_order ) );
     50                        break;
     51                    case 'comment_content':
     52                        $spnrp_tbl_name = $spnrp_comment_table_name;
     53                        $spnrp_results = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %1s WHERE comment_approved = true ORDER BY comment_date %2s', $spnrp_comment_table_name, $spnrp_order ) );
     54                        break;
     55                }
     56                ?>
     57                <div id="col-right">
     58                    <div class="col-wrap">
     59                        <h2 class="screen-reader-text"><?php esc_html_e( 'Phone number list' ); ?></h2>
     60                        <table class="wp-list-table widefat fixed striped tags">
     61                            <thead>
     62                                <tr>
     63                                    <th scope="col" id="spnrp_title" class="manage-column column-spnrp-title column-primary">
     64                                        <span><?php esc_html_e( 'Title' ); ?></span>
     65                                    </th>
     66                                    <th scope="col" id="spnrp_type" class="manage-column column-spnrp-type">
     67                                        <span><?php esc_html_e( 'Type' ); ?></span>
     68                                    </th>
     69                                    <th scope="col" id="spnrp_pnumber" class="manage-column column-spnrp-pnumber">
     70                                        <span><?php esc_html_e( 'Phone numbers' ); ?></span>
     71                                    </th>
     72                                    <th scope="col" id="spnrp_status" class="manage-column column-spnrp-status">
     73                                        <span><?php esc_html_e( 'Status - Clickable' ); ?></span>
     74                                    </th>
     75                                </tr>
     76                            </thead>
     77                            <tbody id="the-list" data-wp-lists="list:tag">
     78                                <?php
     79
     80                                if ( count( $spnrp_results ) > 0 ) {
     81                                    $spnrp_count = 0;
     82                                    foreach ( $spnrp_results as $check ) {
     83                                        $spnrp_found_yes = '';
     84                                        $spnrp_col = '';
     85                                        $spnrp_title = '';
     86                                        $spnrp_type = '';
     87                                        $spnrp_id = '';
     88                                        $spnrp_edit_link = '';
     89
     90                                        if ( $spnrp_tbl_name == $wpdb->prefix . 'posts' && 'post_content' == $spnrp_field ) {
     91                                            $spnrp_col = $check->post_content;
     92                                            $spnrp_title = $check->post_title;
     93                                            $spnrp_type = $check->post_type;
     94                                            $spnrp_id = $check->ID;
     95                                            $spnrp_edit_link = admin_url( 'post.php?post=' . $check->ID . '&action=edit' );
     96                                        }
     97
     98                                        if ( $spnrp_tbl_name == $wpdb->prefix . 'posts' && 'post_excerpt' == $spnrp_field ) {
     99                                            $spnrp_col = $check->post_excerpt;
     100                                            $spnrp_title = $check->post_title;
     101                                            $spnrp_type = $check->post_type;
     102                                            $spnrp_id = $check->ID;
     103                                            $spnrp_edit_link = admin_url( 'post.php?post=' . $check->ID . '&action=edit' );
     104                                        }
     105
     106                                        if ( $spnrp_tbl_name == $wpdb->prefix . 'comments' && 'comment_content' == $spnrp_field ) {
     107                                            $spnrp_col = $check->comment_content;
     108                                            $spnrp_title = get_the_title( $check->comment_post_ID );
     109                                            $spnrp_type = get_comment_type( $check->comment_ID );
     110                                            $spnrp_id = $check->comment_ID;
     111                                            $spnrp_edit_link = admin_url( 'comment.php?action=editcomment&c=' . $check->comment_ID );
     112                                        }
     113
     114                                        // Include phone numbers from post meta.
     115                                        $post_phone_number = get_post_meta( $spnrp_id, 'phone_number', true );
     116                                        if ( $post_phone_number ) {
     117                                            $spnrp_col .= ' ' . $post_phone_number;
     118                                        }
     119
     120                                        // Include phone numbers from comment meta.
     121                                        $comment_phone_number = get_comment_meta( $spnrp_id, 'phone_number', true );
     122                                        if ( $comment_phone_number ) {
     123                                            $spnrp_col .= ' ' . $comment_phone_number;
     124                                        }
     125
     126                                        if ( preg_match_all( '/\+{0,1}[0-9]{0,2}[ .-]*\(*[0-9]{3}\)*[ .-]*[0-9]{3}[ .-]*[0-9]{4}/', $spnrp_col, $matches ) ) {
     127                                            foreach ( $matches[0] as $match ) {
     128                                                $spnrp_found_yes .= '<a href="tel:' . esc_attr( $match ) . '">' . esc_html( $match ) . '</a>,<br>';
     129                                            }
     130                                            ?>
     131                                            <tr>
     132                                                <td class="column-primary">
     133                                                    <strong>
     134                                                        <a class="row-title" href="<?php echo esc_url( $spnrp_edit_link ); ?>"><?php echo esc_html( $spnrp_title ); ?></a>
     135                                                    </strong>
     136                                                    <br>
     137                                                    <div class="row-actions">
     138                                                        <span class="edit"><a href="<?php echo esc_url( $spnrp_edit_link ); ?>">Edit</a> | </span>
     139                                                        <span class="view"><a href="<?php the_permalink( $spnrp_id ); ?>">View</a></span>
     140                                                    </div>
     141                                                </td>
     142                                                <td class="column-spnrp-type">
     143                                                    <p><?php echo esc_html( $spnrp_type ); ?></p>
     144                                                </td>
     145                                                <td class="column-spnrp-pnumber">
     146                                                   <?php echo wp_kses_post( $spnrp_found_yes ); ?>
     147                                                </td>
     148                                                <td class="column-spnrp-status">
     149                                                <span style="color: #01a252"><?php esc_html_e( 'Yes', 'my-phone-number-plugin' ); ?></span>
     150                                                </td>
     151                                            </tr>
     152                                             <?php
     153                                                $spnrp_count++;
     154                                        } else {
     155                                            ?>
     156                                            <tr>
     157                                                <td class="column-primary">
     158                                                    <strong>
     159                                                        <a class="row-title" href="<?php echo esc_url( $spnrp_edit_link ); ?>"><?php echo esc_html( $spnrp_title ); ?></a>
     160                                                    </strong>
     161                                                    <br>
     162                                                    <div class="row-actions">
     163                                                        <span class="edit"><a href="<?php echo esc_url( $spnrp_edit_link ); ?>">Edit</a> | </span>
     164                                                        <span class="view"><a href="<?php the_permalink( $spnrp_id ); ?>">View</a></span>
     165                                                    </div>
     166                                                </td>
     167                                                <td class="column-spnrp-type">
     168                                                <p><?php echo esc_html( $spnrp_type ); ?></p>
     169                                                </td>
     170                                                <td class="column-spnrp-pnumber">
     171                                                 
     172                                                </td>
     173                                                <td class="column-spnrp-status">
     174                                                <span style="color: #F30"><?php esc_html_e( 'No', 'my-phone-number-plugin' ); ?></span>
     175                                                </td>
     176                                            </tr>
     177                                             <?php
     178                                                $spnrp_count++;
     179                                        }
     180                                    }
     181                                    if ( $spnrp_count < 0 ) {
     182                                        ?>
     183                                        <tr class='no-items'>
     184                                            <td class='colspanchange' colspan='4'><?php esc_html_e( 'No results found.', 'my-phone-number-plugin' ); ?></td>
     185                                        </tr>
     186                                        <?php
     187                                    }
     188                                } else {
     189                                    ?>
     190                                    <tr class='no-items'>
     191                                        <td class='colspanchange' colspan='4'><?php esc_html_e( 'No results found.', 'my-phone-number-plugin' ); ?></td>
     192                                    </tr>
     193                                 <?php } ?>
     194                            </tbody>
     195                            <tfoot>
     196                                <tr>
     197                                    <th scope="col" id="spnrp_title" class="manage-column column-spnrp-title column-primary">
     198                                    <span><?php esc_html_e( 'Title', 'my-phone-number-plugin' ); ?></span>
     199                                    </th>
     200                                    <th scope="col" id="spnrp_type" class="manage-column column-spnrp-type">
     201                                    <span><?php esc_html_e( 'Type', 'my-phone-number-plugin' ); ?></span>
     202                                    </th>
     203                                    <th scope="col" id="spnrp_pnumber" class="manage-column column-spnrp-pnumber">
     204                                    <span><?php esc_html_e( 'Phone numbers', 'my-phone-number-plugin' ); ?></span>
     205                                    </th>
     206                                    <th scope="col" id="spnrp_status" class="manage-column column-spnrp-status">
     207                                    <span><?php esc_html_e( 'Status - Clickable', 'my-phone-number-plugin' ); ?></span>
     208                                    </th>
     209                                </tr>
     210                            </tfoot>
     211                        </table>
     212                    </div>
     213                </div><!-- /col-right -->
     214                 <?php
     215            }
     216            ?>
     217            <div id="col-left">
     218                <div class="col-wrap">
     219                    <div class="form-wrap">
     220                        <h2><?php esc_html_e( 'Search Clickable Phone Number', 'my-phone-number-plugin' ); ?></h2>
     221                        <form name="spnrp_form" id="spnrp_from" method="POST" action="">
     222                            <div class="form-field term-parent-wrap">
     223                                <label for="parent"><?php esc_html_e( 'Field', 'my-phone-number-plugin' ); ?></label>
     224                                <select name="spnrp_select_field" id="spnrp_select_field" class="postform">
     225                                    <option value="post_content" <?php echo esc_html( 'post_content' == $spnrp_field ) ? 'selected' : ''; ?>><?php esc_html_e( 'Post Content', 'my-phone-number-plugin' ); ?></option>
     226                                    <option value="post_excerpt" <?php echo esc_html( 'post_excerpt' == $spnrp_field ) ? 'selected' : ''; ?>><?php esc_html_e( 'Post Excerpt', 'my-phone-number-plugin' ); ?></option>
     227                                    <option value="comment_content" <?php echo esc_html( 'comment_content' == $spnrp_field ) ? 'selected' : ''; ?>><?php esc_html_e( 'Comment Content', 'my-phone-number-plugin' ); ?></option>
     228                                </select>
     229                                <p><?php esc_html_e( 'Select a field to search for phone numbers.', 'my-phone-number-plugin' ); ?></p>
     230                            </div>
     231                            <div class="form-field term-parent-wrap">
     232                                <label for="parent"><?php esc_html_e( 'Order', 'my-phone-number-plugin' ); ?></label>
     233                                <select name="spnrp_select_order" id="spnrp_select_order">
     234                                    <option value="ASC" <?php echo esc_html( 'ASC' == $spnrp_order ) ? 'selected' : ''; ?>><?php esc_html_e( 'Ascending', 'my-phone-number-plugin' ); ?></option>
     235                                    <option value="DESC" <?php echo esc_html( 'DESC' == $spnrp_order ) ? 'selected' : ''; ?>><?php esc_html_e( 'Descending', 'my-phone-number-plugin' ); ?></option>
     236                                </select>
     237                                <p><?php esc_html_e( 'Select the order of the search results.', 'my-phone-number-plugin' ); ?></p>
     238                            </div>
     239                            <p class="submit">
     240                                <?php wp_nonce_field( 'spnrp-form-security', 'spnrp_form_security' ); ?>
     241                                <input type="submit" name="spnrp_submit" id="spnrp_submit" class="button button-primary" value="<?php esc_attr_e( 'Search', 'my-phone-number-plugin' ); ?>">
     242                            </p>
     243                        </form>
     244                    </div>
     245                </div><!-- /col-left -->
     246            </div><!-- /col-container -->
     247        </div>
     248    </div>
     249        <?php
     250    }
    244251}
    245 
  • search-clickable-phone-number-for-mobile-device/trunk/readme.txt

    r2742312 r3132579  
    44Tags: search phone number, clickable phone number, identify phone number, phone number, anchor tag, search phone number in posts, pages, comments, search in post content, post excerpt, comment content.
    55Requires at least: 4.0.1
    6 Tested up to: 6.0
     6Tested up to: 6.6
    77Stable tag: 5.3
    88License: GPLv2 or later
     
    4242== Changelog ==
    4343
    44 = 1.0 =
     44= 1.0.0 =
    4545* Beta release with basic testing.
     46
     47= 1.0.1 =
     48* Verified compatibility with the latest versions of WordPress.
     49* Optimized plugin code for better performance.
  • search-clickable-phone-number-for-mobile-device/trunk/search-clickable-phone-number-for-mobile-device.php

    r1441664 r3132579  
    33 * Plugin Name: Search Clickable Phone Number for Mobile Device
    44 * Plugin URI: http://www.brainvire.com
    5  * Description: Enables easy search of clickable phone numbers (wrapped with and without tel in anchor tag) from all posts, custom posts, pages and comments in the website.
    6  * Version: 1.0
     5 * Description: Enables easy search of clickable phone numbers (wrapped with and without tel in anchor tag) from all posts, custom posts, pages, and comments in the website.
     6 * Version: 1.0.1
    77 * Author: brainvireinfo
    88 * Author URI: http://www.brainvire.com
    99 * License: GPL2
     10 *
     11 * @package SearchClickablePhoneNumber
    1012 */
    1113
    12 // Exit if try to access directly.
    13 if( !defined( 'ABSPATH' ) ) exit;
     14if ( ! defined( 'ABSPATH' ) ) {
     15    exit;
     16}
    1417
    15 // Define plugin directory path
     18// Define plugin directory path.
    1619define( 'SEARCH_PHONENO_DIR', plugin_dir_path( __FILE__ ) );
    17 define( 'PHONENO_PLUGIN_URL', plugin_dir_url(__FILE__) );
     20define( 'PHONENO_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    1821
    19 // Includes plugin files
    20 include_once SEARCH_PHONENO_DIR.'phone-number-search-form.php';
     22// Includes plugin files.
     23include_once SEARCH_PHONENO_DIR . 'phone-number-search-form.php';
    2124
    22 // Create custom menu
    23 add_action('admin_menu', 'spnrp_init_install');
     25// Create custom menu.
     26add_action( 'admin_menu', 'spnrp_init_install' );
    2427
    25 if( !function_exists( 'spnrp_init_install' ) ) {
    26    
    27     function spnrp_init_install() {
    28        
    29         // Create new top level menu
    30         add_menu_page(
    31                 'Search phone number with regex pattern', // Page Title
    32                 'SP Number', // Menu Title
    33                 'manage_options', // Capability
    34                 'spnrp-phone-number', // Menu Slug
    35                 'spnrp_search_phone_number', //Callable function
    36                 PHONENO_PLUGIN_URL.'images/search-phone-number-2.png' // Icon
    37                 );
    38     }
     28if ( ! function_exists( 'spnrp_init_install' ) ) {
     29
     30    /**
     31     * Initializes the installation process for the plugin.
     32     *
     33     * This function is responsible for setting up necessary database tables,
     34     * default options, or other initialization tasks required for the plugin.
     35     */
     36    function spnrp_init_install() {
     37
     38        // Create new top level menu.
     39
     40        add_menu_page(
     41            'Search phone number with regex pattern', // Page Title.
     42            'SP Number', // Menu Title.
     43            'manage_options', // Capability.
     44            'spnrp-phone-number', // Menu Slug.
     45            'spnrp_search_phone_number', // Callable function.
     46            PHONENO_PLUGIN_URL . 'images/search-phone-number-2.png' // Icon.
     47        );
     48    }
    3949}
     50
Note: See TracChangeset for help on using the changeset viewer.