PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.6.2
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.6.2
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 2.6.2, at classes/Controllers/Admin/UserExperience.php

105 lines 3.0 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 add_action( "after_plugin_row_{$this->container->get('basename')}", [
26 $this,
27 'after_plugin_row',
28 ], 10, 2 );
29 }
30
31 /**
32 * Render plugin action links.
33 *
34 * @param array<string,string> $links Existing links.
35 * @param string $file Plugin file path.
36 *
37 * @return mixed
38 */
39 public function plugin_action_links( $links, $file ) {
40 $basename = $this->container->get( 'basename' );
41
42 if ( $file === $basename ) {
43 $plugin_action_links = apply_filters(
44 'content_control/plugin_action_links',
45 [
46 '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>',
47 'settings' => '<a href="' . admin_url( 'options-general.php?page=content-control-settings' ) . '">' . __( 'Settings', 'content-control' ) . '</a>',
48 ]
49 );
50
51 if ( $this->container->is_license_active() || $this->container->is_pro_active() ) {
52 unset( $plugin_action_links['upgrade'] );
53 }
54
55 if ( substr( get_locale(), 0, 2 ) === 'en' ) {
56 $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 );
57 }
58
59 foreach ( $plugin_action_links as $link ) {
60 array_unshift( $links, $link );
61 }
62 }
63
64 return $links;
65 }
66
67 /**
68 * Add a row to the plugin list table.
69 *
70 * @param string $file Plugin file path.
71 * @param array<string,string|int> $plugin_data Plugin data.
72 *
73 * @return void
74 */
75 public function after_plugin_row( $file, $plugin_data ) {
76 $plugin_slug = $this->container->get( 'slug' );
77
78 if ( $plugin_slug !== $plugin_data['slug'] ) {
79 return;
80 }
81
82 $plugin_url = $this->container->get( 'url' );
83
84 ?>
85 <!-- <tr class="plugin-update-tr active">
86 <td colspan="3" class="plugin-update colspanchange">
87 <div class="update-message notice inline notice-warning notice-alt">
88 <p>
89 <?php
90 printf(
91 /* translators: %1$s: Plugin name, %2$s: Plugin URL */
92 esc_html__( 'You are using the %1$s plugin. Please visit the %2$s to learn how to use it.', 'content-control' ),
93 '<strong>' . esc_html__( 'Content Control', 'content-control' ) . '</strong>',
94 '<a href="' . esc_url( $plugin_url ) . '" target="_blank">' . esc_html__( 'plugin website', 'content-control' ) . '</a>'
95 );
96 ?>
97 </p>
98 </div>
99 </td>
100 </tr> -->
101
102 <?php
103 }
104 }
105