' . esc_html__( 'Get started', 'tiboform' ) . '',
'' . esc_html__( 'Submissions', 'tiboform' ) . ''
);
if ( ! tiboform_is_pro() ) {
$links[] = '' . esc_html__( 'Upgrade to Pro', 'tiboform' ) . '';
}
return $links;
}
);
add_filter(
'plugin_row_meta',
function ( $meta, $file ) {
if ( plugin_basename( __FILE__ ) !== $file ) {
return $meta;
}
$meta[] = '' . esc_html__( 'Documentation', 'tiboform' ) . '';
$meta[] = '' . esc_html__( 'Support', 'tiboform' ) . '';
$meta[] = '' . esc_html__( 'Rate the plugin', 'tiboform' ) . '';
if ( ! tiboform_is_pro() ) {
$meta[] = '' . esc_html__( 'Upgrade to Pro', 'tiboform' ) . '';
}
return $meta;
},
10,
2
);
/**
* Eski sürümün (1.0.0) kısa önekli verisini bir kez yeni adlara taşır:
* seçenek, geçici veriler, başvuru meta anahtarları, içerik türleri, zamanlanmış görev ve içerikteki kısa kodlar.
*/
function tiboform_migrate_legacy() {
if ( get_option( 'tiboform_legacy_migrated' ) ) {
return;
}
global $wpdb;
$old = 'tf' . 'm'; // Eski önek (yalnız göç için).
$sc = 'tibo' . '_form'; // Eski kısa kod adı.
// Seçenek: tema form eşlemesi.
$map = get_option( $old . '_theme_forms', null );
if ( null !== $map ) {
if ( false === get_option( 'tiboform_theme_forms', false ) ) {
update_option( 'tiboform_theme_forms', $map, false );
}
delete_option( $old . '_theme_forms' );
}
// Geçici veriler (hız sınırı sayaçları).
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", $wpdb->esc_like( '_transient_' . $old . '_' ) . '%', $wpdb->esc_like( '_transient_timeout_' . $old . '_' ) . '%' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
// Başvuru meta anahtarları.
foreach ( array( 'data', 'status', 'page', 'note', 'read' ) as $k ) {
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_key = %s WHERE meta_key = %s", '_tiboform_' . $k, '_' . $old . '_' . $k ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
}
// İçerik türleri.
foreach ( array( 'form', 'entry' ) as $t ) {
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_type = %s WHERE post_type = %s", 'tiboform_' . $t, $old . '_' . $t ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
}
// İçerikteki eski kısa kodlar.
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->posts} SET post_content = REPLACE( post_content, %s, %s ) WHERE post_content LIKE %s", '[' . $sc, '[tiboform', '%' . $wpdb->esc_like( '[' . $sc ) . '%' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
// Zamanlanmış temizlik.
wp_clear_scheduled_hook( $old . '_cleanup' );
if ( ! wp_next_scheduled( 'tiboform_cleanup' ) ) {
wp_schedule_event( time() + HOUR_IN_SECONDS, 'daily', 'tiboform_cleanup' );
}
wp_cache_flush();
update_option( 'tiboform_legacy_migrated', TIBOFORM_VERSION, true );
}
add_action( 'plugins_loaded', 'tiboform_migrate_legacy', 1 );
// Temalar ve Pro eklentisi için: TiboForm API'si hazır.
add_action( 'plugins_loaded', function () { do_action( 'tiboform_loaded' ); }, 5 );
register_activation_hook(
__FILE__,
function () {
// İlk kurulumda hazır bir iletişim formu.
if ( ! get_posts( array( 'post_type' => 'tiboform_form', 'posts_per_page' => 1, 'fields' => 'ids', 'post_status' => 'any' ) ) ) {
tiboform_register_types();
tiboform_create_form( 'contact' );
}
if ( ! wp_next_scheduled( 'tiboform_cleanup' ) ) {
wp_schedule_event( time() + HOUR_IN_SECONDS, 'daily', 'tiboform_cleanup' );
}
}
);
register_deactivation_hook(
__FILE__,
function () {
wp_clear_scheduled_hook( 'tiboform_cleanup' );
}
);