| @@ -396,11 +396,9 @@ | ||
| 396 | 396 | $array_value = array(); |
| 397 | 397 | foreach ( $value as $v ) { |
| 398 | 398 | if ( ! empty( $v ) ) { |
| 399 | 399 | $data = $this->uwp_array_search( $option_values_arr, 'value', $v ); |
| 400 | - if ( ! empty( $data ) && isset( $data[0]['label'] ) ) { | |
| 401 | - $array_value[] = $data[0]['label']; | |
| 402 | - } | |
| 400 | + $array_value[] = $data[0]['label']; | |
| 403 | 401 | } |
| 404 | 402 | |
| 405 | 403 | } |
| 406 | 404 | if ( ! empty( $array_value ) ) { |
| @@ -561,9 +559,8 @@ | ||
| 561 | 559 | * |
| 562 | 560 | * @return array |
| 563 | 561 | */ |
| 564 | 562 | public function get_tabs() { |
| 565 | - global $uwp_profile_doing_tab, $uwp_profile_first_tab; | |
| 566 | 563 | |
| 567 | 564 | // get the settings |
| 568 | 565 | global $uwp_profile_tabs_array; |
| 569 | 566 | // check if we have been here before |
| @@ -574,14 +571,9 @@ | ||
| 574 | 571 | if ( ! empty( $tabs ) ) { |
| 575 | 572 | // get the tab contents first so we can decide to output the tab head |
| 576 | 573 | $tabs_content = array(); |
| 577 | 574 | foreach ( $tabs as $tab ) { |
| 578 | - $uwp_profile_doing_tab = $tab->tab_key; | |
| 579 | 575 | $tabs_content[ $tab->id . "tab" ] = $this->tab_content( $tab ); |
| 580 | - | |
| 581 | - if ( ! ( isset( $tab->tab_level ) && $tab->tab_level > 0 ) && empty( $uwp_profile_first_tab ) && ! empty( $tabs_content[ $tab->id . "tab" ] ) ) { | |
| 582 | - $uwp_profile_first_tab = $tab->tab_key; | |
| 583 | - } | |
| 584 | 576 | } |
| 585 | 577 | |
| 586 | 578 | // setup the array |
| 587 | 579 | foreach ( $tabs as $tab ) { |
| @@ -818,13 +810,13 @@ | ||
| 818 | 810 | 'type' => 'array', |
| 819 | 811 | 'prev_text' => sprintf( |
| 820 | 812 | '%s <span class="nav-prev-text sr-only">%s</span>', |
| 821 | 813 | '<i class="fas fa-chevron-left"></i>', |
| 822 | - __( 'Newer posts', 'userswp' ) | |
| 814 | + __( 'Newer posts', 'ayetheme' ) | |
| 823 | 815 | ), |
| 824 | 816 | 'next_text' => sprintf( |
| 825 | 817 | '<span class="nav-next-text sr-only">%s</span> %s', |
| 826 | - __( 'Older posts', 'userswp' ), | |
| 818 | + __( 'Older posts', 'ayetheme' ), | |
| 827 | 819 | '<i class="fas fa-chevron-right"></i>' |
| 828 | 820 | ), |
| 829 | 821 | ); |
| 830 | 822 | |
| @@ -831,11 +823,11 @@ | ||
| 831 | 823 | // Don't print empty markup if there's only one page. |
| 832 | 824 | if ( $total > 1 ) { |
| 833 | 825 | $args = wp_parse_args( $args, array( |
| 834 | 826 | 'mid_size' => 1, |
| 835 | - 'prev_text' => _x( 'Previous', 'previous set of posts', 'userswp' ), | |
| 836 | - 'next_text' => _x( 'Next', 'next set of posts', 'userswp' ), | |
| 837 | - 'screen_reader_text' => __( 'Posts navigation', 'userswp' ), | |
| 827 | + 'prev_text' => _x( 'Previous', 'previous set of posts' ), | |
| 828 | + 'next_text' => _x( 'Next', 'next set of posts' ), | |
| 829 | + 'screen_reader_text' => __( 'Posts navigation' ), | |
| 838 | 830 | 'total' => $total, |
| 839 | 831 | ) ); |
| 840 | 832 | |
| 841 | 833 | if ( is_front_page() ) { |
| @@ -1154,9 +1146,9 @@ | ||
| 1154 | 1146 | * @return string |
| 1155 | 1147 | */ |
| 1156 | 1148 | public function profile_slug( $slug = 'profile' ) { |
| 1157 | 1149 | if ( $page_id = uwp_get_page_id( 'profile_page', false ) ) { |
| 1158 | - if ( $_slug = get_page_uri( absint( $page_id ) ) ) { | |
| 1150 | + if ( $_slug = get_post_field( 'post_name', absint( $page_id ) ) ) { | |
| 1159 | 1151 | $slug = $_slug; |
| 1160 | 1152 | } |
| 1161 | 1153 | } |
| 1162 | 1154 | return apply_filters( 'uwp_rewrite_profile_slug', $slug ); |
| @@ -1510,19 +1502,10 @@ | ||
| 1510 | 1502 | * @package userswp |
| 1511 | 1503 | * @return void |
| 1512 | 1504 | */ |
| 1513 | 1505 | public function ajax_avatar_banner_upload() { |
| 1514 | - | |
| 1515 | - if ( ! isset( $_POST['security'] ) || ! wp_verify_nonce( $_POST['security'], 'uwp_avatar_banner_upload_nonce' ) ) { | |
| 1516 | - $result['error'] = aui()->alert( array( | |
| 1517 | - 'type' => 'danger', | |
| 1518 | - 'content' => __( "Security check failed.", "userswp" ) | |
| 1519 | - ) ); | |
| 1520 | - $return = json_encode( $result ); | |
| 1521 | - echo $return; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1522 | - die(); | |
| 1523 | - } | |
| 1524 | - | |
| 1506 | + // Image upload handler | |
| 1507 | + // todo: security checks | |
| 1525 | 1508 | $type = strip_tags( esc_sql( $_POST['uwp_popup_type'] ) ); |
| 1526 | 1509 | $result = array(); |
| 1527 | 1510 | |
| 1528 | 1511 | if ( ! in_array( $type, array( 'banner', 'avatar' ) ) ) { |
| @@ -1762,16 +1745,8 @@ | ||
| 1762 | 1745 | * @return string Html. |
| 1763 | 1746 | */ |
| 1764 | 1747 | public function crop_submit_form( $type = 'avatar' ) { |
| 1765 | 1748 | |
| 1766 | - if ( is_admin() && defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) { | |
| 1767 | - $user_id = get_current_user_id(); | |
| 1768 | - } elseif ( is_admin() && current_user_can( 'manage_options' ) && ! empty( $_GET['user_id'] ) && is_numeric( $_GET['user_id'] ) ) { | |
| 1769 | - $user_id = absint( $_GET['user_id'] ); | |
| 1770 | - } else { | |
| 1771 | - $user_id = get_current_user_id(); | |
| 1772 | - } | |
| 1773 | - | |
| 1774 | 1749 | ob_start(); |
| 1775 | 1750 | |
| 1776 | 1751 | // get file sizes |
| 1777 | 1752 | $files = new UsersWP_Files(); |
| @@ -1778,14 +1753,12 @@ | ||
| 1778 | 1753 | $max_file_size = $files->uwp_get_max_upload_size( $type ); |
| 1779 | 1754 | |
| 1780 | 1755 | $design_style = uwp_get_option( "design_style", 'bootstrap' ); |
| 1781 | 1756 | $template = $design_style ? $design_style . "/modal-profile-image.php" : "modal-profile-image.php"; |
| 1782 | - uwp_get_template( $template, array( 'user_id' => $user_id ) ); | |
| 1757 | + uwp_get_template( $template ); | |
| 1783 | 1758 | |
| 1784 | 1759 | $content_wrap = $design_style == 'bootstrap' ? '.uwp-profile-image-change-modal .modal-content' : '#uwp-popup-modal-wrap'; |
| 1785 | 1760 | $bg_color = apply_filters('uwp_crop_image_bg_color', '', $type); |
| 1786 | - | |
| 1787 | - $ajax_nonce = wp_create_nonce( 'uwp_avatar_banner_upload_nonce' ); | |
| 1788 | 1761 | ?> |
| 1789 | 1762 | |
| 1790 | 1763 | <script type="text/javascript"> |
| 1791 | 1764 | (function ($, window, undefined) { |
| @@ -1825,10 +1798,8 @@ | ||
| 1825 | 1798 | fd.append('<?php echo esc_attr( $type ); ?>', file); |
| 1826 | 1799 | // our AJAX identifier |
| 1827 | 1800 | fd.append('action', 'uwp_avatar_banner_upload'); |
| 1828 | 1801 | fd.append('uwp_popup_type', '<?php echo esc_attr( $type ); ?>'); |
| 1829 | - // Add nonce for security | |
| 1830 | - fd.append('security', '<?php echo esc_js( $ajax_nonce ); ?>'); | |
| 1831 | 1802 | |
| 1832 | 1803 | $("#progressBar").show().removeClass('d-none'); |
| 1833 | 1804 | |
| 1834 | 1805 | $.ajax({ |
| @@ -1875,10 +1846,9 @@ | ||
| 1875 | 1846 | trueSize: [uwp_true_width, uwp_true_height], |
| 1876 | 1847 | minSize: [uwp_full_width, uwp_full_height] |
| 1877 | 1848 | }); |
| 1878 | 1849 | } |
| 1879 | - }, | |
| 1880 | - | |
| 1850 | + } | |
| 1881 | 1851 | }); |
| 1882 | 1852 | }); |
| 1883 | 1853 | |
| 1884 | 1854 | function showProgress(evt) { |