| @@ -4,14 +4,8 @@ | ||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | class FrmFormMigratorsHelper { |
| 7 | 7 | |
| 8 | - /** | |
| 9 | - * @param array $form | |
| 10 | - * @param array|null $dismissed | |
| 11 | - * | |
| 12 | - * @return bool | |
| 13 | - */ | |
| 14 | 8 | private static function is_dismissed( $form, $dismissed = null ) { |
| 15 | 9 | if ( $dismissed === null ) { |
| 16 | 10 | $dismissed = get_option( 'frm_dismissed' ); |
| 17 | 11 | } |
| @@ -22,14 +16,10 @@ | ||
| 22 | 16 | |
| 23 | 17 | return false; |
| 24 | 18 | } |
| 25 | 19 | |
| 26 | - /** | |
| 27 | - * @return void | |
| 28 | - */ | |
| 29 | 20 | public static function maybe_show_download_link() { |
| 30 | 21 | $forms = self::import_links(); |
| 31 | - | |
| 32 | 22 | foreach ( $forms as $form ) { |
| 33 | 23 | if ( ! self::is_dismissed( $form ) ) { |
| 34 | 24 | self::install_banner( $form ); |
| 35 | 25 | } else { |
| @@ -41,20 +31,13 @@ | ||
| 41 | 31 | } |
| 42 | 32 | |
| 43 | 33 | /** |
| 44 | 34 | * @since 4.05 |
| 45 | - * | |
| 46 | - * @return void | |
| 47 | 35 | */ |
| 48 | 36 | public static function maybe_add_to_inbox() { |
| 37 | + $inbox = new FrmInbox(); | |
| 49 | 38 | $forms = self::import_links(); |
| 50 | 39 | |
| 51 | - if ( ! $forms ) { | |
| 52 | - return; | |
| 53 | - } | |
| 54 | - | |
| 55 | - $inbox = new FrmInbox(); | |
| 56 | - | |
| 57 | 40 | foreach ( $forms as $form ) { |
| 58 | 41 | $inbox->add_message( |
| 59 | 42 | array( |
| 60 | 43 | 'key' => $form['class'], |
| @@ -67,11 +50,8 @@ | ||
| 67 | 50 | ); |
| 68 | 51 | } |
| 69 | 52 | } |
| 70 | 53 | |
| 71 | - /** | |
| 72 | - * @return array | |
| 73 | - */ | |
| 74 | 54 | private static function import_links() { |
| 75 | 55 | if ( ! current_user_can( 'activate_plugins' ) ) { |
| 76 | 56 | return array(); |
| 77 | 57 | } |
| @@ -76,9 +56,8 @@ | ||
| 76 | 56 | return array(); |
| 77 | 57 | } |
| 78 | 58 | |
| 79 | 59 | $forms = array(); |
| 80 | - | |
| 81 | 60 | foreach ( self::importable_forms() as $form ) { |
| 82 | 61 | if ( class_exists( $form['class'] ) || ! is_plugin_active( $form['plugin'] ) ) { |
| 83 | 62 | // Either the importer is installed or the source plugin isn't. |
| 84 | 63 | continue; |
| @@ -83,9 +62,9 @@ | ||
| 83 | 62 | // Either the importer is installed or the source plugin isn't. |
| 84 | 63 | continue; |
| 85 | 64 | } |
| 86 | 65 | |
| 87 | - $installer = new FrmInstallPlugin( array( 'plugin_file' => $form['importer'] ) ); | |
| 66 | + $installer = new FrmInstallPlugin( array( 'plugin_file' => $form['importer'] ) ); | |
| 88 | 67 | $form['installed'] = $installer->is_installed(); |
| 89 | 68 | $form['link'] = $installer->get_activate_link(); |
| 90 | 69 | |
| 91 | 70 | $forms[] = $form; |
| @@ -92,11 +71,8 @@ | ||
| 92 | 71 | } |
| 93 | 72 | return $forms; |
| 94 | 73 | } |
| 95 | 74 | |
| 96 | - /** | |
| 97 | - * @return string[][] | |
| 98 | - */ | |
| 99 | 75 | private static function importable_forms() { |
| 100 | 76 | return array( |
| 101 | 77 | 'gf' => array( |
| 102 | 78 | 'class' => 'FrmGravityImporter', |
| @@ -114,13 +90,8 @@ | ||
| 114 | 90 | ), |
| 115 | 91 | ); |
| 116 | 92 | } |
| 117 | 93 | |
| 118 | - /** | |
| 119 | - * @param array $install | |
| 120 | - * | |
| 121 | - * @return string|null | |
| 122 | - */ | |
| 123 | 94 | private static function install_banner( $install ) { |
| 124 | 95 | if ( empty( $install['link'] ) ) { |
| 125 | 96 | return ''; |
| 126 | 97 | } |
| @@ -138,14 +109,8 @@ | ||
| 138 | 109 | </div> |
| 139 | 110 | <?php |
| 140 | 111 | } |
| 141 | 112 | |
| 142 | - /** | |
| 143 | - * @param array $install | |
| 144 | - * @param string $label | |
| 145 | - * | |
| 146 | - * @return void | |
| 147 | - */ | |
| 148 | 113 | private static function install_button( $install, $label = '' ) { |
| 149 | 114 | $primary = 'button-secondary frm-button-secondary '; |
| 150 | 115 | |
| 151 | 116 | if ( empty( $label ) ) { |
| @@ -175,15 +140,11 @@ | ||
| 175 | 140 | </a> |
| 176 | 141 | <?php |
| 177 | 142 | } |
| 178 | 143 | |
| 179 | - /** | |
| 180 | - * @return void | |
| 181 | - */ | |
| 182 | 144 | public static function dismiss_migrator() { |
| 183 | 145 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 184 | 146 | $dismissed = get_option( 'frm_dismissed' ); |
| 185 | - | |
| 186 | 147 | if ( empty( $dismissed ) ) { |
| 187 | 148 | $dismissed = array(); |
| 188 | 149 | } |
| 189 | 150 | $dismissed[] = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' ); |
| @@ -188,6 +149,13 @@ | ||
| 188 | 149 | } |
| 189 | 150 | $dismissed[] = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' ); |
| 190 | 151 | update_option( 'frm_dismissed', array_filter( $dismissed ), 'no' ); |
| 191 | 152 | wp_die(); |
| 153 | + } | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * @deprecated 4.05 | |
| 157 | + */ | |
| 158 | + public static function notification_count() { | |
| 159 | + _deprecated_function( __METHOD__, '4.05' ); | |
| 192 | 160 | } |
| 193 | 161 | } |