here semi auto updates should work (Admin panel notice and install on confirmation). If not please manually update as described here.',
'advanced-responsive-video-embedder'
),
$name,
$req_ver,
esc_url( get_admin_url() . 'options-general.php?page=nextgenthemes' ),
'https://nextgenthemes.com/plugins/arve/documentation/installation/'
);
Notices::instance()->register_notice(
'ngt-arve-' . $name . '-outdated-v' . $req_ver,
'notice-error',
wp_kses( $msg, ALLOWED_HTML, array( 'https' ) ),
array(
'cap' => 'update_plugins',
)
);
}
}
function action_admin_init_setup_messages(): void {
foreach ( ADDONS as $addon_name ) {
addon_outdated_notice( $addon_name );
}
if ( display_pro_ad() ) {
Notices::instance()->register_notice(
'ngt-arve-addon-ad',
'notice-info',
wp_kses( ad_html(), ALLOWED_HTML, array( 'https' ) ),
array(
'cap' => 'install_plugins',
)
);
}
if ( str_contains_any( VERSION, array( 'alpha', 'beta' ) ) && version_compare( VERSION, get_latest_beta(), '<' ) ) {
$beta_ver = get_latest_beta();
Notices::instance()->register_notice(
"ngt-arve-beta-$beta_ver",
'notice-info',
wp_kses(
sprintf(
// Translators: %1$s URL, %2$s version tag.
__( 'Latest ARVE pre-release is out! Please do a manual update.
(1) Download arve-%2$s.zip. (2) Go to Plugins > Add New > Upload Plugin. (3) Install. (4) nextgenthemes.com/support/ if something goes wrong.', 'advanced-responsive-video-embedder' ),
esc_url( "https://github.com/nextgenthemes/advanced-responsive-video-embedder/releases/download/$beta_ver/advanced-responsive-video-embedder-$beta_ver.zip" ),
esc_html( $beta_ver ),
esc_url( 'https://nextgenthemes.com/support/' )
),
ALLOWED_HTML,
array( 'https' )
),
array(
'cap' => 'install_plugins',
)
);
}
if ( is_gutenberg() &&
! is_plugin_active( 'gutenberg/gutenberg.php' ) &&
version_compare( $GLOBALS['wp_version'], '6.6-beta2', '<' )
) {
Notices::instance()->register_notice(
'ngt-arve-need-gb2',
'notice-info',
wp_kses(
sprintf(
// Translators: %1$s URL, %2$s version tag.
__( 'For the ARVE Block to work you currently need the Gutenberg plugin active or WP 6.6-RC2 or later. Reason is unknown at the time of writing this.', 'advanced-responsive-video-embedder' ),
admin_url( 'plugin-install.php?s=Gutenberg%2520Team&tab=search&type=term' ),
esc_url( 'https://wordpress.org/news/2024/07/wordpress-6-6-rc2/' )
),
ALLOWED_HTML,
array( 'https' )
),
array(
'cap' => 'install_plugins',
)
);
}
}
function get_latest_beta(): string {
$ver = '10.0.0-alpha9';
$gh_tag = remote_get_json_cached(
'https://api.github.com/repos/nextgenthemes/advanced-responsive-video-embedder/releases/latest',
array(),
'tag_name',
HOUR_IN_SECONDS
);
if ( ! is_wp_error( $gh_tag ) && str_contains_any( $gh_tag, array( 'alpha', 'beta' ) ) ) {
$ver = $gh_tag;
}
return $ver;
}
function ad_html(): string {
$html = esc_html__( 'Hi, this is Nico(las Jonas) the author of the ARVE Advanced Responsive Video Embedder plugin. If you are interested in additional features and/or want to support the work I do on this plugin please consider buying the Pro Addon.', 'advanced-responsive-video-embedder' );
$html = "
$html
'; printf( 'Documentation, ', 'https://nextgenthemes.com/plugins/arve/documentation/' ); printf( 'Support, ', 'https://nextgenthemes.com/support/' ); printf( '%s', esc_url( admin_url( 'admin.php?page=advanced-responsive-video-embedder' ) ), esc_html__( 'Settings', 'advanced-responsive-video-embedder' ) ); echo '
'; printf( 'ARVE Pro Addon Features:', 'https://nextgenthemes.com/plugins/arve-pro/' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_readfile echo wp_kses( ad_html(), ALLOWED_HTML, array( 'https' ) ); } function register_shortcode_ui(): void { $attrs = array(); $settings = settings( 'shortcode' )->get_all(); foreach ( $settings as $key => $s ) : $field = array( 'attr' => $key, 'label' => $s->label, ); if ( ! empty( $s->placeholder ) ) { $field['meta']['placeholder'] = $s->placeholder; } if ( 'thumbnail' === $key ) { $field['type'] = 'attachment'; $field['libraryType'] = array( 'image' ); $field['addButton'] = __( 'Select Image', 'advanced-responsive-video-embedder' ); $field['frameTitle'] = __( 'Select Image', 'advanced-responsive-video-embedder' ); } switch ( $s->type ) { case 'boolean': $field['type'] = 'checkbox'; break; case 'string': if ( $s->options ) { $field['type'] = 'select'; $field['options'] = convert_to_shortcode_ui_options( $s->options ); } else { $field['type'] = 'text'; } break; case 'integer': $field['type'] = 'number'; break; } $attrs[] = $field; endforeach; \shortcode_ui_register_for_shortcode( 'arve', array( 'label' => esc_html( 'ARVE' ), 'listItemImage' => 'dashicons-format-video', 'attrs' => $attrs, ) ); } /** * Converts an associative array to an array of options suitable for Shortcode UI. * Each key-value pair in the input array is transformed into an associative array * with 'value' and 'label' keys. * * @param array