Traits
4 years ago
CFF_About.php
4 years ago
CFF_About_Us.php
4 years ago
CFF_Admin.php
4 years ago
CFF_Global_Settings.php
4 years ago
CFF_Install_Skin.php
4 years ago
CFF_New_User.php
4 years ago
CFF_Notifications.php
4 years ago
CFF_Support.php
4 years ago
CFF_Tracking.php
4 years ago
CFF_Upgrader.php
4 years ago
CFF_oEmbeds.php
4 years ago
CFF_About_Us.php
349 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * The About Page |
| 5 | * |
| 6 | * @since 4.0 |
| 7 | */ |
| 8 | |
| 9 | namespace CustomFacebookFeed\Admin; |
| 10 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 11 | |
| 12 | use CustomFacebookFeed\CFF_View; |
| 13 | use CustomFacebookFeed\CFF_Response; |
| 14 | |
| 15 | class CFF_About_Us { |
| 16 | /** |
| 17 | * Admin menu page slug. |
| 18 | * |
| 19 | * @since 4.0 |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | const SLUG = 'cff-about-us'; |
| 24 | |
| 25 | /** |
| 26 | * Initializing the class |
| 27 | * |
| 28 | * @since 4.0 |
| 29 | */ |
| 30 | function __construct(){ |
| 31 | $this->init(); |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Determining if the user is viewing the our page, if so, party on. |
| 36 | * |
| 37 | * @since 4.0 |
| 38 | */ |
| 39 | public function init() { |
| 40 | if ( ! is_admin() ) { |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | add_action( 'admin_menu', [ $this, 'register_menu' ] ); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Register Menu. |
| 49 | * |
| 50 | * @since 4.0 |
| 51 | */ |
| 52 | function register_menu() { |
| 53 | $cap = current_user_can( 'manage_custom_facebook_feed_options' ) ? 'manage_custom_facebook_feed_options' : 'manage_options'; |
| 54 | $cap = apply_filters( 'cff_settings_pages_capability', $cap ); |
| 55 | |
| 56 | $about_us = add_submenu_page( |
| 57 | 'cff-top', |
| 58 | __( 'About Us', 'custom-facebook-feed' ), |
| 59 | __( 'About Us', 'custom-facebook-feed' ), |
| 60 | $cap, |
| 61 | self::SLUG, |
| 62 | [$this, 'about_us'], |
| 63 | 4 |
| 64 | ); |
| 65 | add_action( 'load-' . $about_us, [$this,'about_us_enqueue_assets']); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Enqueue About Us Page CSS & Script. |
| 70 | * |
| 71 | * Loads only for About Us page |
| 72 | * |
| 73 | * @since 4.0 |
| 74 | */ |
| 75 | public function about_us_enqueue_assets(){ |
| 76 | if( ! get_current_screen() ) { |
| 77 | return; |
| 78 | } |
| 79 | $screen = get_current_screen(); |
| 80 | if ( ! 'facebook-feed_page_cff-about-us' === $screen->id ) { |
| 81 | return; |
| 82 | } |
| 83 | |
| 84 | wp_enqueue_style( |
| 85 | 'about-style', |
| 86 | CFF_PLUGIN_URL . 'admin/assets/css/about.css', |
| 87 | false, |
| 88 | CFFVER |
| 89 | ); |
| 90 | |
| 91 | wp_enqueue_script( |
| 92 | 'vue-main', |
| 93 | 'https://cdn.jsdelivr.net/npm/vue@2.6.12', |
| 94 | null, |
| 95 | '2.6.12', |
| 96 | true |
| 97 | ); |
| 98 | |
| 99 | wp_enqueue_script( |
| 100 | 'about-app', |
| 101 | CFF_PLUGIN_URL.'admin/assets/js/about.js', |
| 102 | null, |
| 103 | CFFVER, |
| 104 | true |
| 105 | ); |
| 106 | |
| 107 | $cff_about = $this->page_data(); |
| 108 | |
| 109 | wp_localize_script( |
| 110 | 'about-app', |
| 111 | 'cff_about', |
| 112 | $cff_about |
| 113 | ); |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Page Data to use in front end |
| 118 | * |
| 119 | * @since 4.0 |
| 120 | * |
| 121 | * @return array |
| 122 | */ |
| 123 | public function page_data() { |
| 124 | // get the WordPress's core list of installed plugins |
| 125 | if ( ! function_exists( 'get_plugins' ) ) { |
| 126 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 127 | } |
| 128 | $license_key = null; |
| 129 | if ( get_option('cff_license_key') ) { |
| 130 | $license_key = get_option('cff_license_key'); |
| 131 | } |
| 132 | |
| 133 | $installed_plugins = get_plugins(); |
| 134 | |
| 135 | $images_url = CFF_PLUGIN_URL . 'admin/assets/img/about/'; |
| 136 | |
| 137 | |
| 138 | |
| 139 | $plugins_info = $this->get_plugins_info( $installed_plugins ); |
| 140 | |
| 141 | $return = array( |
| 142 | 'admin_url' => admin_url(), |
| 143 | 'supportPageUrl' => admin_url( 'admin.php?page=cff-support' ), |
| 144 | 'ajax_handler' => admin_url( 'admin-ajax.php' ), |
| 145 | 'links' => \CustomFacebookFeed\Builder\CFF_Feed_Builder::get_links_with_utm(), |
| 146 | 'nonce' => wp_create_nonce( 'cff-admin' ), |
| 147 | 'socialWallLinks' => \CustomFacebookFeed\Builder\CFF_Feed_Builder::get_social_wall_links(), |
| 148 | 'socialWallActivated' => is_plugin_active( 'social-wall/social-wall.php' ), |
| 149 | 'genericText' => array( |
| 150 | 'help' => __( 'Help', 'custom-facebook-feed' ), |
| 151 | 'title' => __( 'About Us', 'custom-facebook-feed' ), |
| 152 | 'title2' => __( 'Our Other Social Media Feed Plugins', 'custom-facebook-feed' ), |
| 153 | 'title3' => __( 'Plugins we recommend', 'custom-facebook-feed' ), |
| 154 | 'description2' => __( 'We’re more than just a Facebook plugin! Check out our other plugins and add more content to your site.', 'custom-facebook-feed' ), |
| 155 | ), |
| 156 | 'aboutBox' => array( |
| 157 | 'atSmashBalloon' => __( 'At Smash Balloon, we build software that helps you create beautiful responsive social media feeds for your website in minutes.', 'custom-facebook-feed' ), |
| 158 | 'weAreOn' => __( 'We\'re on a mission to make it super simple to add social media feeds in WordPress. No more complicated setup steps, ugly iframe widgets, or negative page speed scores.', 'custom-facebook-feed' ), |
| 159 | 'ourPlugins' => __( 'Our plugins aren\'t just easy to use, but completely customizable, reliable, and fast! Which is why over 1.6 million awesome users, just like you, choose to use them on their site.', 'custom-facebook-feed' ), |
| 160 | 'teamAvatar' => CFF_PLUGIN_URL . 'admin/assets/img/team-avatar.png', |
| 161 | 'teamImgAlt' => __( 'Smash Balloon Team', 'custom-facebook-feed' ), |
| 162 | ), |
| 163 | 'pluginsInfo' => $plugins_info, |
| 164 | 'social_wall' => array( |
| 165 | 'plugin' => 'social-wall/social-wall.php', |
| 166 | 'title' => __( 'Social Wall', 'custom-facebook-feed' ), |
| 167 | 'description' => __( 'Combine feeds from all of our plugins into a single wall', 'custom-facebook-feed' ), |
| 168 | 'graphic' => CFF_PLUGIN_URL . 'admin/assets/img/social-wall-graphic.png', |
| 169 | 'permalink' => 'https://smashballoon.com/social-wall/demo?utm_campaign=facebook-free&utm_source=about&utm_medium=social-wall', |
| 170 | 'installed' => isset( $installed_plugins['social-wall/social-wall.php'] ) ? true : false, |
| 171 | 'activated' => is_plugin_active('social-wall/social-wall.php'), |
| 172 | ), |
| 173 | 'recommendedPlugins' => array( |
| 174 | 'wpforms' => array( |
| 175 | 'plugin' => 'wpforms-lite/wpforms.php', |
| 176 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/wpforms-lite.zip', |
| 177 | 'title' => __( 'WPForms', 'custom-facebook-feed' ), |
| 178 | 'description' => __( 'The most beginner friendly drag & drop WordPress forms plugin allowing you to create beautiful contact forms, subscription forms, payment forms, and more in minutes, not hours!', 'custom-facebook-feed' ), |
| 179 | 'icon' => $images_url . 'plugin-wpforms.png', |
| 180 | 'installed' => isset( $installed_plugins['wpforms-lite/wpforms.php'] ) ? true : false, |
| 181 | 'activated' => is_plugin_active('wpforms-lite/wpforms.php'), |
| 182 | ), |
| 183 | 'monsterinsights' => array( |
| 184 | 'plugin' => 'google-analytics-for-wordpress/googleanalytics.php', |
| 185 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/google-analytics-for-wordpress.zip', |
| 186 | 'title' => __( 'MonsterInsights', 'custom-facebook-feed' ), |
| 187 | 'description' => __( 'MonsterInsights makes it “effortless” to properly connect your WordPress site with Google Analytics, so you can start making data-driven decisions to grow your business.', 'custom-facebook-feed' ), |
| 188 | 'icon' => $images_url . 'plugin-mi.png', |
| 189 | 'installed' => isset( $installed_plugins['google-analytics-for-wordpress/googleanalytics.php'] ) ? true : false, |
| 190 | 'activated' => is_plugin_active('google-analytics-for-wordpress/googleanalytics.php'), |
| 191 | ), |
| 192 | 'optinmonster' => array( |
| 193 | 'plugin' => 'optinmonster/optin-monster-wp-api.php', |
| 194 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/optinmonster.zip', |
| 195 | 'title' => __( 'OptinMonster', 'custom-facebook-feed' ), |
| 196 | 'description' => __( 'Our high-converting optin forms like Exit-Intent® popups, Fullscreen Welcome Mats, and Scroll boxes help you dramatically boost conversions and get more email subscribers.', 'custom-facebook-feed' ), |
| 197 | 'icon' => $images_url . 'plugin-om.png', |
| 198 | 'installed' => isset( $installed_plugins['optinmonster/optin-monster-wp-api.php'] ) ? true : false, |
| 199 | 'activated' => is_plugin_active('optinmonster/optin-monster-wp-api.php'), |
| 200 | ), |
| 201 | 'wp_mail_smtp' => array( |
| 202 | 'plugin' => 'wp-mail-smtp/wp_mail_smtp.php', |
| 203 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/wp-mail-smtp.zip', |
| 204 | 'title' => __( 'WP Mail SMTP', 'custom-facebook-feed' ), |
| 205 | 'description' => __( 'Make sure your website\'s emails reach the inbox. Our goal is to make email deliverability easy and reliable. Trusted by over 1 million websites.', 'custom-facebook-feed' ), |
| 206 | 'icon' => $images_url . 'plugin-smtp.png', |
| 207 | 'installed' => isset( $installed_plugins['wp-mail-smtp/wp_mail_smtp.php'] ) ? true : false, |
| 208 | 'activated' => is_plugin_active('wp-mail-smtp/wp_mail_smtp.php'), |
| 209 | ), |
| 210 | 'rafflepress' => array( |
| 211 | 'plugin' => 'rafflepress/rafflepress.php', |
| 212 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/rafflepress.zip', |
| 213 | 'title' => __( 'RafflePress', 'custom-facebook-feed' ), |
| 214 | 'description' => __( 'Turn your visitors into brand ambassadors! Easily grow your email list, website traffic, and social media followers with powerful viral giveaways & contests.', 'custom-facebook-feed' ), |
| 215 | 'icon' => $images_url . 'plugin-rp.png', |
| 216 | 'installed' => isset( $installed_plugins['rafflepress/rafflepress.php'] ) ? true : false, |
| 217 | 'activated' => is_plugin_active('rafflepress/rafflepress.php'), |
| 218 | ), |
| 219 | 'aioseo' => array( |
| 220 | 'plugin' => 'all-in-one-seo-pack/all_in_one_seo_pack.php', |
| 221 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip', |
| 222 | 'title' => __( 'All in One SEO Pack', 'custom-facebook-feed' ), |
| 223 | 'description' => __( 'Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs, business sites, or ecommerce sites, and much more.', 'custom-facebook-feed' ), |
| 224 | 'icon' => $images_url . 'plugin-seo.png', |
| 225 | 'installed' => isset( $installed_plugins['all-in-one-seo-pack/all_in_one_seo_pack.php'] ) ? true : false, |
| 226 | 'activated' => is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php'), |
| 227 | ) |
| 228 | ), |
| 229 | 'buttons' => array( |
| 230 | 'add' => __( 'Add', 'custom-facebook-feed' ), |
| 231 | 'viewDemo' => __( 'View Demo', 'custom-facebook-feed' ), |
| 232 | 'install' => __( 'Install', 'custom-facebook-feed' ), |
| 233 | 'installed' => __( 'Installed', 'custom-facebook-feed' ), |
| 234 | 'activate' => __( 'Activate', 'custom-facebook-feed' ), |
| 235 | 'deactivate' => __( 'Deactivate', 'custom-facebook-feed' ), |
| 236 | 'open' => __( 'Open', 'custom-facebook-feed' ), |
| 237 | 'upgradeToPro' => __( 'Upgrade to Pro', 'custom-facebook-feed' ), |
| 238 | ), |
| 239 | 'icons' => array( |
| 240 | 'plusIcon' => '<svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.0832 6.83317H7.08317V11.8332H5.4165V6.83317H0.416504V5.1665H5.4165V0.166504H7.08317V5.1665H12.0832V6.83317Z" fill="white"/></svg>', |
| 241 | 'loaderSVG' => '<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#fff" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/></path></svg>', |
| 242 | 'checkmarkSVG' => '<svg width="13" height="10" viewBox="0 0 13 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.13112 6.88917L11.4951 0.525204L12.9093 1.93942L5.13112 9.71759L0.888482 5.47495L2.3027 4.06074L5.13112 6.88917Z" fill="#8C8F9A"/></svg>', |
| 243 | 'link' => '<svg width="10" height="11" viewBox="0 0 10 11" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.333374 9.22668L7.39338 2.16668H3.00004V0.833344H9.66671V7.50001H8.33338V3.10668L1.27337 10.1667L0.333374 9.22668Z" fill="#141B38"/></svg>' |
| 244 | ), |
| 245 | ); |
| 246 | |
| 247 | return $return; |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * About Us Page View Template |
| 252 | * |
| 253 | * @since 4.0 |
| 254 | */ |
| 255 | public function about_us(){ |
| 256 | return CFF_View::render( 'about.index' ); |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Get Plugins Info |
| 261 | * |
| 262 | * @since 4.1.2 |
| 263 | * |
| 264 | * @return array |
| 265 | */ |
| 266 | public function get_plugins_info( $installed_plugins ){ |
| 267 | $plugins_info = []; |
| 268 | $plugins_list = [ |
| 269 | 'facebook' => [ |
| 270 | 'free' => 'custom-facebook-feed/custom-facebook-feed.php', |
| 271 | 'pro' => 'custom-facebook-feed-pro/custom-facebook-feed.php', |
| 272 | 'link' => 'https://smashballoon.com/custom-facebook-feed/' |
| 273 | ], |
| 274 | 'instagram' => [ |
| 275 | 'free' => 'instagram-feed/instagram-feed.php', |
| 276 | 'pro' => 'instagram-feed-pro/instagram-feed.php', |
| 277 | 'link' => 'https://smashballoon.com/instagram-feed/' |
| 278 | ], |
| 279 | 'twitter' => [ |
| 280 | 'free' => 'custom-twitter-feeds/custom-twitter-feed.php', |
| 281 | 'pro' => 'custom-twitter-feeds-pro/custom-twitter-feed.php', |
| 282 | 'link' => 'https://smashballoon.com/custom-twitter-feeds/' |
| 283 | ], |
| 284 | 'youtube' => [ |
| 285 | 'free' => 'feeds-for-youtube/youtube-feed.php', |
| 286 | 'pro' => 'youtube-feed-pro/youtube-feed.php', |
| 287 | 'link' => 'https://smashballoon.com/youtube-feed/' |
| 288 | ] |
| 289 | ]; |
| 290 | |
| 291 | foreach ($plugins_list as $name => $plugin) { |
| 292 | $type = 'none'; |
| 293 | $activated = 'none'; |
| 294 | if( isset( $installed_plugins[$plugins_list[$name]['free']] ) ){ |
| 295 | $type = 'free'; |
| 296 | $activated = is_plugin_active( $plugins_list[$name]['free'] ); |
| 297 | } |
| 298 | if( isset( $installed_plugins[$plugins_list[$name]['pro']] ) ){ |
| 299 | $type = 'pro'; |
| 300 | $activated = is_plugin_active( $plugins_list[$name]['pro'] ); |
| 301 | } |
| 302 | $plugins_list[ $name ]['activated'] = $activated; |
| 303 | $plugins_list[ $name ]['type'] = $type; |
| 304 | } |
| 305 | |
| 306 | $plugins_info = [ |
| 307 | 'facebook' => array( |
| 308 | 'plugin' => $plugins_list['facebook']['pro'], |
| 309 | 'link' => $plugins_list['facebook']['link'], |
| 310 | 'title' => __( 'Custom Facebook Feed', 'custom-facebook-feed' ), |
| 311 | 'description' => __( 'Add Facebook posts from your timeline, albums and much more.', 'custom-facebook-feed' ), |
| 312 | 'icon' => CFF_PLUGIN_URL . 'admin/assets/img/fb-icon.svg', |
| 313 | 'activated' => $plugins_list['facebook']['activated'] , |
| 314 | 'type' => $plugins_list['facebook']['type'] , |
| 315 | ), |
| 316 | 'instagram' => array( |
| 317 | 'plugin' => $plugins_list['instagram']['pro'], |
| 318 | 'link' => $plugins_list['instagram']['link'], |
| 319 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/instagram-feed.zip', |
| 320 | 'title' => __( 'Instagram Feed', 'custom-facebook-feed' ), |
| 321 | 'description' => __( 'A quick and elegant way to add your Instagram posts to your website. ', 'custom-facebook-feed' ), |
| 322 | 'icon' => CFF_PLUGIN_URL . 'admin/assets/img/insta-icon.svg', |
| 323 | 'activated' => $plugins_list['instagram']['activated'] , |
| 324 | 'type' => $plugins_list['instagram']['type'] , |
| 325 | ), |
| 326 | 'twitter' => array( |
| 327 | 'plugin' => $plugins_list['twitter']['pro'], |
| 328 | 'link' => $plugins_list['twitter']['link'], |
| 329 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/custom-twitter-feeds.zip', |
| 330 | 'title' => __( 'Custom Twitter Feeds', 'custom-facebook-feed' ), |
| 331 | 'description' => __( 'A customizable way to display tweets from your Twitter account. ', 'custom-facebook-feed' ), |
| 332 | 'icon' => CFF_PLUGIN_URL . 'admin/assets/img/twitter-icon.svg', |
| 333 | 'activated' => $plugins_list['twitter']['activated'] , |
| 334 | 'type' => $plugins_list['twitter']['type'] , |
| 335 | ), |
| 336 | 'youtube' => array( |
| 337 | 'plugin' => $plugins_list['youtube']['pro'], |
| 338 | 'link' => $plugins_list['youtube']['link'], |
| 339 | 'download_plugin' => 'https://downloads.wordpress.org/plugin/feeds-for-youtube.zip', |
| 340 | 'title' => __( 'Feeds for YouTube', 'custom-facebook-feed' ), |
| 341 | 'description' => __( 'A simple yet powerful way to display videos from YouTube. ', 'custom-facebook-feed' ), |
| 342 | 'icon' => CFF_PLUGIN_URL . 'admin/assets/img/youtube-icon.svg', |
| 343 | 'activated' => $plugins_list['youtube']['activated'] , |
| 344 | 'type' => $plugins_list['youtube']['type'] , |
| 345 | ) |
| 346 | ]; |
| 347 | return $plugins_info; |
| 348 | } |
| 349 | } |