| @@ 19-70 (lines=52) @@ | ||
| 16 | ); |
|
| 17 | } |
|
| 18 | ||
| 19 | static function dashboard_ui() { |
|
| 20 | $strings = json_encode( array( |
|
| 21 | 'WAITING' => array( |
|
| 22 | 'action' => __( 'Refresh Status', 'jetpack' ), |
|
| 23 | 'status' => __( 'Indexing request queued and waiting…', 'jetpack' ), |
|
| 24 | ), |
|
| 25 | 'INDEXING' => array( |
|
| 26 | 'action' => __( 'Refresh Status', 'jetpack' ), |
|
| 27 | 'status' => __( 'Indexing posts', 'jetpack' ), |
|
| 28 | ), |
|
| 29 | 'DONE' => array( |
|
| 30 | 'action' => __( 'Reindex Posts', 'jetpack' ), |
|
| 31 | 'status' => __( 'Posts indexed.', 'jetpack' ), |
|
| 32 | ), |
|
| 33 | 'ERROR' => array( |
|
| 34 | 'action' => __( 'Refresh Status', 'jetpack' ), |
|
| 35 | 'status' => __( 'Status unknown.', 'jetpack' ), |
|
| 36 | ), |
|
| 37 | 'ERROR:LARGE' => array( |
|
| 38 | 'action' => __( 'Refresh Status', 'jetpack' ), |
|
| 39 | 'status' => __( 'This site is too large, please contact Jetpack support to sync.', 'jetpack' ), |
|
| 40 | ), |
|
| 41 | ) ); |
|
| 42 | ||
| 43 | wp_enqueue_script( |
|
| 44 | 'jetpack_sync_reindex_control', |
|
| 45 | plugins_url( '_inc/jquery.jetpack-sync.js', JETPACK__PLUGIN_FILE ), |
|
| 46 | array( 'jquery' ), |
|
| 47 | JETPACK__VERSION |
|
| 48 | ); |
|
| 49 | ||
| 50 | // $template = <<<EOT |
|
| 51 | // <p class="jetpack_sync_reindex_control" id="jetpack_sync_reindex_control" data-strings="%s"> |
|
| 52 | // <input type="submit" class="jetpack_sync_reindex_control_action button" value="%s" disabled /> |
|
| 53 | // <span class="jetpack_sync_reindex_control_status">…</span> |
|
| 54 | // </p> |
|
| 55 | // EOT; |
|
| 56 | ||
| 57 | $template = <<<EOT |
|
| 58 | <p class="jetpack_sync_reindex_control" id="jetpack_sync_reindex_control" data-strings="%s"> |
|
| 59 | This is a test |
|
| 60 | <input type="submit" class="jetpack_sync_reindex_control_action button" value="%s" disabled /> |
|
| 61 | <span class="jetpack_sync_reindex_control_status">…</span> |
|
| 62 | </p> |
|
| 63 | EOT; |
|
| 64 | ||
| 65 | return sprintf( |
|
| 66 | $template, |
|
| 67 | esc_attr( $strings ), |
|
| 68 | esc_attr__( 'Refresh Status', 'jetpack' ) |
|
| 69 | ); |
|
| 70 | } |
|
| 71 | ||
| 72 | } |
|
| 73 | ||
| @@ 66-109 (lines=44) @@ | ||
| 63 | return $response; |
|
| 64 | } |
|
| 65 | ||
| 66 | static function reindex_ui() { |
|
| 67 | $strings = json_encode( array( |
|
| 68 | 'WAITING' => array( |
|
| 69 | 'action' => __( 'Refresh Status', 'jetpack' ), |
|
| 70 | 'status' => __( 'Indexing request queued and waiting…', 'jetpack' ), |
|
| 71 | ), |
|
| 72 | 'INDEXING' => array( |
|
| 73 | 'action' => __( 'Refresh Status', 'jetpack' ), |
|
| 74 | 'status' => __( 'Indexing posts', 'jetpack' ), |
|
| 75 | ), |
|
| 76 | 'DONE' => array( |
|
| 77 | 'action' => __( 'Reindex Posts', 'jetpack' ), |
|
| 78 | 'status' => __( 'Posts indexed.', 'jetpack' ), |
|
| 79 | ), |
|
| 80 | 'ERROR' => array( |
|
| 81 | 'action' => __( 'Refresh Status', 'jetpack' ), |
|
| 82 | 'status' => __( 'Status unknown.', 'jetpack' ), |
|
| 83 | ), |
|
| 84 | 'ERROR:LARGE' => array( |
|
| 85 | 'action' => __( 'Refresh Status', 'jetpack' ), |
|
| 86 | 'status' => __( 'This site is too large, please contact Jetpack support to sync.', 'jetpack' ), |
|
| 87 | ), |
|
| 88 | ) ); |
|
| 89 | ||
| 90 | wp_enqueue_script( |
|
| 91 | 'jetpack_sync_reindex_control', |
|
| 92 | plugins_url( '_inc/jquery.jetpack-sync.js', JETPACK__PLUGIN_FILE ), |
|
| 93 | array( 'jquery' ), |
|
| 94 | JETPACK__VERSION |
|
| 95 | ); |
|
| 96 | ||
| 97 | $template = <<<EOT |
|
| 98 | <p class="jetpack_sync_reindex_control" id="jetpack_sync_reindex_control" data-strings="%s"> |
|
| 99 | <input type="submit" class="jetpack_sync_reindex_control_action button" value="%s" disabled /> |
|
| 100 | <span class="jetpack_sync_reindex_control_status">…</span> |
|
| 101 | </p> |
|
| 102 | EOT; |
|
| 103 | ||
| 104 | return sprintf( |
|
| 105 | $template, |
|
| 106 | esc_attr( $strings ), |
|
| 107 | esc_attr__( 'Refresh Status', 'jetpack' ) |
|
| 108 | ); |
|
| 109 | } |
|
| 110 | ||
| 111 | private function _get_post_count_local() { |
|
| 112 | global $wpdb; |
|