diff --git a/.gitignore b/.gitignore index 3f9c8036..56e77fea 100644 --- a/.gitignore +++ b/.gitignore @@ -62,10 +62,7 @@ wp-content/mu-plugins/wpe-wp-sign-on-plugin* /wp-admin /wp-includes /wp-content/themes/* -!/wp-content/themes/academyAfrica -!/wp-content/themes/hello-elementor /wp-content/plugins/* -!/wp-content/plugins/index.php /wp-content/mu-plugins .htaccess apple-touch-icon-precomposed.png @@ -74,6 +71,7 @@ favicon.ico wpe-deploy-status-academyafrica robots.txt wordpress +node_modules # large/disallowed file types # a CDN should be used for these @@ -111,3 +109,8 @@ wordpress *.avi .env + +!/wp-content/themes/academyAfrica +!/wp-content/themes/hello-elementor +!/wp-content/plugins/index.php +!/wp-content/plugins/academy-africa \ No newline at end of file diff --git a/contrib/docker-compose/php/php.ini b/contrib/docker-compose/php/php.ini new file mode 100644 index 00000000..d01770f9 --- /dev/null +++ b/contrib/docker-compose/php/php.ini @@ -0,0 +1 @@ +allow_url_fopen: 1 diff --git a/docker-compose.yml b/docker-compose.yml index d5d6b1e5..1ea5cf15 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,4 +17,5 @@ services: - ./wp-content/themes:/var/www/html/wp-content/themes - ./wp-content/plugins:/var/www/html/wp-content/plugins - ./contrib/docker-compose/php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini + - ./contrib/docker-compose/php/php.ini:/usr/local/etc/php/php.ini diff --git a/wp-content/plugins/academy-africa/academy-africa.php b/wp-content/plugins/academy-africa/academy-africa.php new file mode 100644 index 00000000..2161d594 --- /dev/null +++ b/wp-content/plugins/academy-africa/academy-africa.php @@ -0,0 +1,44 @@ +.secondary~.secondary { + margin-top: 10px; +} + +.root .links .secondary { + margin-top: 30px; + color: var(--shades-white, #fff); + font-family: Open Sans; + font-size: 16px; + font-style: normal; + font-weight: 800; + line-height: 19px; + display: inline-block; +} + +.root .links .secondary~ { + margin-top: 10px; +} + +@media only screen and (max-width: 768px) { + .root .links .secondary { + text-align: center; + } +} + +.root .embed { + color: var(--shades-white, #fff); + max-width: 240px; +} + +@media only screen and (max-width: 768px) { + .root .embed { + max-width: 100%; + text-align: center; + } +} + +.root .embed .title { + color: var(--shades-white, #fff); + font-family: Open Sans; + font-size: 23px; + font-style: normal; + font-weight: 300; + line-height: 28px; + /* 121.739% */ + margin-bottom: 30px; +} + +.root .embed #mc_embed_signup { + font-weight: 400; + color: inherit; + background-color: unset; + width: 100%; + text-align: left; +} + +.root .embed #mc_embed_signup input[type="text"], +.root .embed #mc_embed_signup input[type="email"] { + box-sizing: border-box; + font-weight: 400; + border: 1px solid #d0cbcb; + border-radius: 0; + display: flex; + height: 36px; + margin-bottom: 30px; + outline: none; + padding: 0 12px; + width: 100%; +} + +.root .embed #mc_embed_signup input::placeholder { + color: #d0cbcb; + opacity: 1; + -webkit-text-fill-color: #d0cbcb; +} + +.root .embed #mc_embed_signup input:focus, +.root .embed #mc_embed_signup textarea:focus { + border: 1px solid var(--primary-700, #0c1a81); + /* Replace with your actual primary color */ +} + +.root .embed #mc_embed_signup input:active, +.root .embed #mc_embed_signup textarea:active { + border: 1px solid var(--primary-700, #0c1a81); + /* Replace with your actual highlight color */ +} + +.root .embed #mc_embed_signup input[type="submit"] { + font-size: 1.25rem; + line-height: 1.6; + font-weight: 600; + background: none; + border: none; + color: inherit; + padding: 0; + text-decoration: underline; +} \ No newline at end of file diff --git a/wp-content/plugins/academy-africa/includes/assets/css/header.css b/wp-content/plugins/academy-africa/includes/assets/css/header.css new file mode 100644 index 00000000..e69de29b diff --git a/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=facebook, Size=24, Color=CurrentColor.svg b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=facebook, Size=24, Color=CurrentColor.svg new file mode 100644 index 00000000..3914b332 --- /dev/null +++ b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=facebook, Size=24, Color=CurrentColor.svg @@ -0,0 +1,3 @@ + + + diff --git a/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=github, Size=24, Color=CurrentColor.svg b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=github, Size=24, Color=CurrentColor.svg new file mode 100644 index 00000000..33fc4f5f --- /dev/null +++ b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=github, Size=24, Color=CurrentColor.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=instagram, Size=24, Color=CurrentColor.svg b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=instagram, Size=24, Color=CurrentColor.svg new file mode 100644 index 00000000..2680211c --- /dev/null +++ b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=instagram, Size=24, Color=CurrentColor.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=linkedin, Size=24, Color=CurrentColor.svg b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=linkedin, Size=24, Color=CurrentColor.svg new file mode 100644 index 00000000..18e5c230 --- /dev/null +++ b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=linkedin, Size=24, Color=CurrentColor.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=slack, Size=24, Color=CurrentColor.svg b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=slack, Size=24, Color=CurrentColor.svg new file mode 100644 index 00000000..2f69259e --- /dev/null +++ b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=slack, Size=24, Color=CurrentColor.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=twitter, Size=24, Color=CurrentColor.svg b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=twitter, Size=24, Color=CurrentColor.svg new file mode 100644 index 00000000..cc56e409 --- /dev/null +++ b/wp-content/plugins/academy-africa/includes/assets/images/icons/Type=twitter, Size=24, Color=CurrentColor.svg @@ -0,0 +1,3 @@ + + + diff --git a/wp-content/plugins/academy-africa/includes/plugin.php b/wp-content/plugins/academy-africa/includes/plugin.php new file mode 100644 index 00000000..e96d56a6 --- /dev/null +++ b/wp-content/plugins/academy-africa/includes/plugin.php @@ -0,0 +1,264 @@ +is_compatible()) { + add_action('elementor/init', [$this, 'init']); + } + } + + /** + * Compatibility Check + * + * Checks if the installed version of Elementor meets the plugin's minimum requirement. + * + * @since 1.0.0 + * @access public + */ + + public function is_compatible() + { + // Check if Elementor installed and activated + if (!did_action('elementor/loaded')) { + add_action('admin_notices', [$this, 'admin_notice_missing_main_plugin']); + return false; + } + + // Check if the installed version of Elementor meets the plugin's minimum requirement. + if (!version_compare(ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=')) { + add_action('admin_notices', [$this, 'admin_notice_minimum_elementor_version']); + return false; + } + + // Check if the installed version of PHP meets the plugin's minimum requirement. + if (!version_compare(PHP_VERSION, self::MINIMUM_PHP_VERSION, '>=')) { + add_action('admin_notices', [$this, 'admin_notice_minimum_php_version']); + return false; + } + + return true; + } + + /** + * Admin notice + * + * Warning when the site doesn't have Elementor installed or activated. + * + * @since 1.0.0 + * @access public + */ + public function admin_notice_missing_main_plugin() + { + if (isset($_GET['activate'])) unset($_GET['activate']); + + $message = sprintf( + /* translators: 1: Plugin name 2: Elementor */ + esc_html__('"%1$s" requires "%2$s" to be installed and activated.', 'academy-africa'), + '' . esc_html__('academyAfrica Elementor Addon', 'academy-africa') . '', + '' . esc_html__('Elementor', 'academy-africa') . '' + ); + + printf('

%1$s

', $message); + } + + /** + * Admin notice + * + * Warning when the site doesn't have a minimum required Elementor version. + * + * @since 1.0.0 + * @access public + */ + public function admin_notice_minimum_elementor_version() + { + if (isset($_GET['activate'])) unset($_GET['activate']); + + $message = sprintf( + /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */ + esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'academy-africa'), + '' . esc_html__('academyAfrica Elementor Addon', 'academy-africa') . '', + '' . esc_html__('Elementor', 'academy-africa') . '', + self::MINIMUM_ELEMENTOR_VERSION + ); + + printf('

%1$s

', $message); + } + + /** + * Admin notice + * + * Warning when the site doesn't have a minimum required PHP version. + * + * @since 1.0.0 + * @access public + */ + public function admin_notice_minimum_php_version() + { + if (isset($_GET['activate'])) unset($_GET['activate']); + + $message = sprintf( + /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ + esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'academy-africa'), + '' . esc_html__('academyAfrica Elementor Addon', 'academy-africa') . '', + '' . esc_html__('PHP', 'academy-africa') . '', + self::MINIMUM_PHP_VERSION + ); + + printf('

%1$s

', $message); + } + + /** + * Initialize the plugin + * + * Load the plugin only after Elementor (and other plugins) are loaded. + * + * @since 1.0.0 + * @access public + */ + + public function init() + { + + add_action('elementor/widgets/register', [$this, 'register_widgets']); + add_action('elementor/frontend/after_enqueue_styles', [$this, 'register_widget_styles']); + add_action('elementor/elements/categories_registered', [$this, 'add_elementor_widget_categories']); + } + + /** + * Include Widgets files + * + * Load widgets files + * + * @since 1.0.0 + * @access private + */ + public function register_widgets($widgets_manager) + { + require_once(__DIR__ . '/widgets/footer.php'); + $widgets_manager->register(new \Academy_Africa_Footer()); + } + + public function register_widget_styles() + { + wp_enqueue_style( + 'academy-africa', + plugins_url('assets/css/academy-africa.css', __FILE__), + [], + [], + filemtime(plugin_dir_path(__FILE__) . 'assets/css/academy-africa.css') + ); + + wp_enqueue_style( + 'academy-africa-header', + plugins_url('assets/css/header.css', __FILE__), + [ + 'academy-africa' + ], + filemtime(plugin_dir_path(__FILE__) . 'assets/css/header.css') + ); + + wp_enqueue_style( + 'academy-africa-footer', + plugins_url('assets/css/footer.css', __FILE__), + [ + 'academy-africa' + ], + filemtime(plugin_dir_path(__FILE__) . 'assets/css/footer.css') + ); + } + + /** + * Add custom category + * + * @since 1.0.0 + * @access public + */ + public function add_elementor_widget_categories($elements_manager) + { + $elements_manager->add_category( + 'academy-africa', + [ + 'title' => __('Academy Africa', 'academy-africa'), + 'icon' => 'fa fa-plug', + ] + ); + } +} diff --git a/wp-content/plugins/academy-africa/includes/widgets/footer.php b/wp-content/plugins/academy-africa/includes/widgets/footer.php new file mode 100644 index 00000000..b7205c08 --- /dev/null +++ b/wp-content/plugins/academy-africa/includes/widgets/footer.php @@ -0,0 +1,267 @@ +start_controls_section( + 'section_header', + [ + 'label' => __('Header', 'academy-africa'), + ] + ); + $this->add_control( + 'logo', + [ + 'label' => esc_html__('Choose Image', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::MEDIA, + 'default' => [ + 'url' => wp_get_attachment_image_src($this->get_custom_logo()[0], 'full'), + ], + ] + ); + $this->add_control( + 'site_description', + [ + 'label' => __('Site Description', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::TEXTAREA, + 'default' => __('', 'academy-africa'), + ] + ); + + $this->add_control( + 'stay_in_touch_text', + [ + 'label' => __('Stay in Touch', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::TEXT, + 'default' => __('STAY IN TOUCH', 'academy-africa'), + ] + ); + $links = new \Elementor\Repeater(); + + $links->add_control( + 'label', + [ + 'label' => esc_html__('Label', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::TEXT, + 'default' => 'Link Label', + ] + ); + + $links->add_control( + 'page_link', + [ + 'label' => esc_html__('Page Link', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::URL, + 'default' => [ + 'url' => '', + ], + ] + ); + + $social_media = new \Elementor\Repeater(); + $social_media->add_control( + 'type', + [ + 'label' => esc_html__('Type', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::SELECT, + 'default' => 'github', + 'options' => [ + 'facebook' => esc_html__('Facebook', 'academy-africa'), + 'github' => esc_html__('Github', 'academy-africa'), + 'slack' => esc_html__('Slack', 'academy-africa'), + 'linkedin' => esc_html__('LinkedIn', 'academy-africa'), + 'instagram' => esc_html__('Instagram', 'academy-africa'), + 'twitter' => esc_html__('Twitter', 'academy-africa'), + ] + ] + ); + + $social_media->add_control( + 'link', + [ + 'label' => esc_html__('Page Link', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::URL, + 'default' => [ + 'url' => '', + ], + ] + ); + + $this->add_control( + 'social_media_links', + [ + 'label' => esc_html__('Social Media Links', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::REPEATER, + 'fields' => $social_media->get_controls(), + 'title_field' => '{{{ type }}}', + ] + ); + + $this->add_control( + 'primary_links', + [ + 'label' => esc_html__('Primary Links', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::REPEATER, + 'fields' => $links->get_controls(), + 'title_field' => '{{{ label }}}', + ] + ); + + $this->add_control( + 'secondary_links', + [ + 'label' => esc_html__('Primary Links', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::REPEATER, + 'fields' => $links->get_controls(), + 'title_field' => '{{{ label }}}', + ] + ); + $this->add_control( + 'newsletter_signup_text', + [ + 'label' => __('Sign in to our Newslettter', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::TEXTAREA, + 'default' => __('Subscribe to the Code for Africa newsletter', 'academy-africa'), + ] + ); + $this->add_control( + 'newsletter_embed_code', + [ + 'label' => __('Newsletter embed code', 'academy-africa'), + 'type' => \Elementor\Controls_Manager::CODE, + ] + ); + $this->end_controls_section(); + } + + function get_menu_items($name) + { + $list = wp_get_nav_menu_items($name); + $menu_items = []; + foreach ($list as $item) { + $menu_items[] = [ + 'title' => $item->title, + 'url' => $item->url, + 'id' => $item->ID, + 'parent_id' => $item->menu_item_parent, + ]; + } + $menu = []; + foreach ($menu_items as $item) { + if ($item['parent_id'] == 0) { + $menu[$item['id']] = $item; + } else { + $menu[$item['parent_id']]['children'][] = $item; + } + } + return $menu; + } + + function get_custom_logo() + { + $custom_logo_id = get_theme_mod('custom_logo'); + $image = wp_get_attachment_image($custom_logo_id, 'full'); + return $image; + } + + + protected function render() + { + $settings = $this->get_settings_for_display(); + $newsletter_embed_code = $settings['newsletter_embed_code']; + $site_description = $settings['site_description']; + $stay_in_touch_text = $settings['stay_in_touch_text']; + $image_url = isset($settings['logo']['url']) ? esc_url($settings['logo']['url']) : ''; + +?> + +