PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / trunk
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
content-control / classes / Controllers / Admin / UserExperience.php

UserExperience.php in Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More trunk, at classes/Controllers/Admin/UserExperience.php

63 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin User Experience controller.
4 *
5 * @package ContentControl\Admin
6 * @copyright (c) 2023 Code Atlantic LLC
7 */
8
9 namespace ContentControl\Controllers\Admin;
10
11 use ContentControl\Base\Controller;
12
13 /**
14 * UserExperience controller class.
15 */
16 class UserExperience extends Controller {
17
18 /**
19 * Initialize widget editor UX.
20 *
21 * @return void
22 */
23 public function init() {
24 add_filter( 'plugin_action_links', [ $this, 'plugin_action_links' ], 10, 2 );
25 }
26
27 /**
28 * Render plugin action links.
29 *
30 * @param array<string,string> $links Existing links.
31 * @param string $file Plugin file path.
32 *
33 * @return mixed
34 */
35 public function plugin_action_links( $links, $file ) {
36 $basename = $this->container->get( 'basename' );
37
38 if ( $file === $basename ) {
39 $plugin_action_links = apply_filters(
40 'content_control/plugin_action_links',
41 [
42 'upgrade' => '<a target="_blank" href="https://contentcontrolplugin.com/pricing/?utm_campaign=upgrade-to-pro&utm_source=plugins-page&utm_medium=plugin-ui&utm_content=action-links-upgrade-text">' . __( 'Upgrade to Pro', 'content-control' ) . '</a>',
43 'settings' => '<a href="' . admin_url( 'options-general.php?page=content-control-settings' ) . '">' . __( 'Settings', 'content-control' ) . '</a>',
44 ]
45 );
46
47 if ( $this->container->is_pro_active() ) {
48 unset( $plugin_action_links['upgrade'] );
49 }
50
51 if ( substr( get_locale(), 0, 2 ) === 'en' ) {
52 $plugin_action_links = array_merge( [ 'translate' => '<a href="' . sprintf( 'https://translate.wordpress.org/locale/%s/default/wp-plugins/content-control/', substr( get_locale(), 0, 2 ) ) . '" target="_blank">' . __( 'Translate', 'content-control' ) . '</a>' ], $plugin_action_links );
53 }
54
55 foreach ( $plugin_action_links as $link ) {
56 array_unshift( $links, $link );
57 }
58 }
59
60 return $links;
61 }
62 }
63