public function showMenu() { ABH_Classes_Tools::checkErrorSettings(); /* Force call of error display */ ABH_Classes_ObjController::getController('ABH_Classes_Error')->hookNotices(); parent::init(); }
/** * This function will load the media in the header for each class * * @return void */ protected function hookHead() { if (!is_admin()) { //this hook is for admin panel only return; } if ($class = ABH_Classes_ObjController::getClassPath($this->name)) { ABH_Classes_ObjController::getController('ABH_Classes_DisplayController')->loadMedia($class['name']); } }
/** * Get all actions from config.xml in core directory and add them in the WP * * @return void */ public function getActions($cur_action) { /* if config allready in cache */ if (!isset(self::$config)) { $config_file = _ABH_CORE_DIR_ . 'config.xml'; if (!file_exists($config_file)) { return; } /* load configuration blocks data from core config files */ $data = file_get_contents($config_file); self::$config = json_decode(json_encode((array) simplexml_load_string($data)), 1); } if (is_array(self::$config)) { foreach (self::$config['block'] as $block) { if (isset($block['active']) && $block['active'] == 1) { /* if there is a single action */ if (isset($block['actions']['action'])) { /* if there are more actions for the current block */ if (!is_array($block['actions']['action'])) { /* add the action in the actions array */ if ($block['actions']['action'] == $cur_action) { $this->actions[] = array('class' => $block['name']); } } else { /* if there are more actions for the current block */ foreach ($block['actions']['action'] as $action) { /* add the actions in the actions array */ if ($action == $cur_action) { $this->actions[] = array('class' => $block['name']); } } } } } } } /* add the actions in WP */ foreach ($this->actions as $actions) { ABH_Classes_ObjController::getController($actions['class'])->action(); } }
public function action() { switch (ABH_CLasses_Tools::getValue('action')) { //login action case 'update': case 'createuser': $user_id = ABH_CLasses_Tools::getValue('user_id'); //Get the default settings $settings = ABH_Classes_Tools::getOption('abh_author' . $user_id); $settings['abh_use'] = (bool) ABH_CLasses_Tools::getValue('abh_use'); $settings['abh_nofollow_social'] = (int) ABH_CLasses_Tools::getValue('abh_nofollow_social'); $settings['abh_title'] = ABH_CLasses_Tools::getValue('abh_title'); $settings['abh_company'] = ABH_CLasses_Tools::getValue('abh_company'); $settings['abh_company_url'] = ABH_CLasses_Tools::getValue('abh_company_url'); $settings['abh_extra_description'] = ABH_CLasses_Tools::getValue('abh_extra_description'); // -- $settings['abh_socialtext'] = ABH_CLasses_Tools::getValue('abh_socialtext'); $settings['abh_twitter'] = ABH_CLasses_Tools::getValue('abh_twitter'); $settings['abh_facebook'] = ABH_CLasses_Tools::getValue('abh_facebook'); $settings['abh_google'] = ABH_CLasses_Tools::getValue('abh_google'); $settings['abh_linkedin'] = ABH_CLasses_Tools::getValue('abh_linkedin'); $settings['abh_klout'] = ABH_CLasses_Tools::getValue('abh_klout'); $settings['abh_instagram'] = ABH_CLasses_Tools::getValue('abh_instagram'); $settings['abh_flickr'] = ABH_CLasses_Tools::getValue('abh_flickr'); $settings['abh_pinterest'] = ABH_CLasses_Tools::getValue('abh_pinterest'); $settings['abh_tumblr'] = ABH_CLasses_Tools::getValue('abh_tumblr'); $settings['abh_youtube'] = ABH_CLasses_Tools::getValue('abh_youtube'); $settings['abh_vimeo'] = ABH_CLasses_Tools::getValue('abh_vimeo'); // -- $settings['abh_theme'] = ABH_CLasses_Tools::getValue('abh_theme'); $settings['abh_position'] = ABH_CLasses_Tools::getValue('abh_position'); /* if there is an icon to upload */ if (isset($_FILES['abh_gravatar']) && !empty($_FILES['abh_gravatar'])) { $return = $this->model->addImage($_FILES['abh_gravatar']); if ($return['name'] != '') { $settings['abh_gravatar'] = $return['name']; } if ($return['message'] != '') { define('ABH_MESSAGE_FAVICON', $return['message']); } } if (ABH_CLasses_Tools::getValue('abh_resetgravatar') == 1) { $settings['abh_gravatar'] = ''; } ABH_Classes_Tools::saveOptions('abh_author' . $user_id, $settings); ABH_Classes_Tools::emptyCache(); ABH_Classes_Tools::checkErrorSettings(); /* Force call of error display */ ABH_Classes_ObjController::getController('ABH_Classes_Error')->hookNotices(); break; case 'abh_get_box': $user_id = ABH_CLasses_Tools::getValue('user_id'); $theme = ABH_CLasses_Tools::getValue('abh_theme'); ABH_CLasses_Tools::setOption('abh_titlefontsize', ABH_CLasses_Tools::getValue('abh_titlefontsize', 'default')); ABH_CLasses_Tools::setOption('abh_descfontsize', ABH_CLasses_Tools::getValue('abh_descfontsize', 'default')); if ($theme == 'default') { $theme = ABH_Classes_Tools::getOption('abh_theme'); } $str = ''; $str .= '<script type="text/javascript" src="' . _ABH_ALL_THEMES_URL_ . $theme . '/js/frontend.js?ver=' . ABH_VERSION . '"></script>'; $str .= '<link rel="stylesheet" href="' . _ABH_ALL_THEMES_URL_ . $theme . '/css/frontend.css?ver=' . ABH_VERSION . '" type="text/css" media="all" />'; $str .= ABH_Classes_ObjController::getController('ABH_Controllers_Frontend')->showBox($user_id); ABH_Classes_Tools::setHeader('json'); echo json_encode(array('box' => $str)); exit; break; } }
Plugin URI: Author: Squirrly UK Description: Starbox is the Author Box for Humans. Professional Themes to choose from, HTML5, Social Media Profiles, Google Authorship Version: 2.2.0 Author URI: http://www.squirrly.co */ /* SET THE CURRENT VERSION ABOVE AND BELOW */ define('ABH_VERSION', '2.2.0'); /* Call config files */ require dirname(__FILE__) . '/config/config.php'; /* important to check the PHP version */ if (PHP_VERSION_ID >= 5100) { /* inport main classes */ require_once _ABH_CLASSES_DIR_ . 'ObjController.php'; require_once _ABH_CLASSES_DIR_ . 'BlockController.php'; /* Main class call */ ABH_Classes_ObjController::getController('ABH_Classes_FrontController')->run(); if (!is_admin()) { ABH_Classes_ObjController::getController('ABH_Controllers_Frontend'); } } else { /* Main class call */ add_action('admin_notices', array(ABH_Classes_ObjController::getController('ABH_Classes_FrontController'), 'phpVersionError')); } // -- // Upgrade StarBox call. register_activation_hook(__FILE__, 'abh_upgrade'); function abh_upgrade() { set_transient('abh_upgrade', true, 30); }
/** * Get all core classes from config.xml in core directory * */ public function getShortcodes() { if (self::$shortCodesSet == true) { return; } //If the user doesn't use shortcodes if (ABH_Classes_Tools::getOption('abh_shortcode') == 0) { return; } self::$shortCodesSet = true; /* if config allready in cache */ if (!isset(ABH_Classes_ObjController::$config)) { $config_file = _ABH_CORE_DIR_ . 'config.xml'; if (!file_exists($config_file)) { return; } /* load configuration blocks data from core config files */ $data = file_get_contents($config_file); ABH_Classes_ObjController::$config = json_decode(json_encode((array) simplexml_load_string($data)), 1); } // echo '<pre>' . print_r(ABH_Classes_ObjController::$config['block'], true) . '</br>'; //print_r(ABH_Classes_ObjController::$config); if (is_array(ABH_Classes_ObjController::$config)) { foreach (ABH_Classes_ObjController::$config['block'] as $block) { if (isset($block['name'])) { if (isset($block['active']) && $block['active'] == 1) { if (isset($block['shortcodes']['shortcode'])) { $instance = ABH_Classes_ObjController::getController($block['name']); if (!is_array($block['shortcodes']['shortcode'])) { if (is_callable(array($instance, 'hookShortWidget' . ucfirst($block['shortcodes']['shortcode'])))) { add_action('widget_text', array($instance, 'hookShortWidget' . ucfirst($block['shortcodes']['shortcode'])), 10, 1); } add_shortcode($block['shortcodes']['shortcode'], array($instance, 'hookShort' . ucfirst($block['shortcodes']['shortcode']))); } else { foreach ($block['shortcodes']['shortcode'] as $shortcode) { if (is_callable(array($instance, 'hookShortWidget' . ucfirst($shortcode)))) { add_action('widget_text', array($instance, 'hookShortWidget' . ucfirst($shortcode)), 10, 1); } add_shortcode($shortcode, array($instance, 'hookShort' . ucfirst($shortcode))); } } } } } } } }
</span> </div> <div id="abh_box_preview_title"><?php _e('Preview mode (change the theme)', _ABH_PLUGIN_NAME_); ?> </div> <div id="abh_box_preview"><?php if ($theme == 'default') { $theme = ABH_Classes_Tools::getOption('abh_theme'); } if (file_exists(_ABH_ALL_THEMES_DIR_ . $theme . '/js/frontend.js')) { echo '<script type="text/javascript" src="' . _ABH_ALL_THEMES_URL_ . $theme . '/js/frontend.js?ver=' . ABH_VERSION . '"></script>'; } echo '<link rel="stylesheet" href="' . _ABH_ALL_THEMES_URL_ . $theme . '/css/frontend.css?ver=' . ABH_VERSION . '" type="text/css" media="all" />'; echo ABH_Classes_ObjController::getController('ABH_Controllers_Frontend')->showBox($view->user->ID); ?> </div> </fieldset> <fieldset> <legend><?php _e('Job settings:', _ABH_PLUGIN_NAME_); ?> </legend> <div> <p><span><?php _e('Job Title:', _ABH_PLUGIN_NAME_); ?> </span> <input type="text" name="abh_title" value="<?php echo $view->author['abh_title']; ?>
/** * Hook the Frontend Header load */ public function hookFronthead() { global $wp_query; $post = null; //echo '<pre>' . print_r($wp_query, true) . '</pre>'; if (is_single() && (ABH_Classes_Tools::getOption('abh_strictposts') == 0 || ABH_Classes_Tools::getOption('abh_strictposts') == 1 && get_post_type() == 'post') && ABH_Classes_Tools::getOption('abh_inposts') == 1 || is_singular() && get_post_type() == 'page' && ABH_Classes_Tools::getOption('abh_inpages') == 1 || ABH_Classes_Tools::getOption('abh_ineachpost') == 1 && (is_category() || is_tag() || !is_singular() && get_post_type() == 'page' || ABH_Classes_Tools::getOption('abh_strictposts') == 0 && is_archive() || ABH_Classes_Tools::getOption('abh_strictposts') == 0 && is_search())) { $theme = ABH_Classes_Tools::getOption('abh_theme'); if (!empty($wp_query->posts)) { foreach ($wp_query->posts as $post) { if ($post->ID && get_post_status($post->ID) == 'publish') { // Get the author data $post = get_post($post->ID); break; } } } // cancel on errors if (!isset($post) || !isset($post->post_author)) { return; } // get the author data if (is_author()) { $this->model->author = get_queried_object(); } else { $this->model->author = get_userdata($post->post_author); } //get the author details settings $this->model->details = ABH_Classes_Tools::getOption('abh_author' . $this->model->author->ID); if (isset($this->model->details['abh_lpc'])) { //if the latest post category is set $this->model->category = $this->model->details['abh_lpc']; } //Se the author box position if (isset($this->model->details['abh_position']) && $this->model->details['abh_position'] != 'default') { $this->model->position = $this->model->details['abh_position']; } else { $this->model->position = ABH_Classes_Tools::getOption('abh_position'); } // For some themes the position is important to be on top if (strpos($this->model->details['abh_theme'], 'topstar') !== false || $this->model->details['abh_theme'] == 'default' && strpos(ABH_Classes_Tools::getOption('abh_theme'), 'topstar') !== false) { $this->model->position = 'up'; } //force position for this theme if (isset($this->model->details) && !empty($this->model->details) && $this->model->details['abh_theme'] != '' && $this->model->details['abh_theme'] != 'default') { $theme = $this->model->details['abh_theme']; } // set theme for author box shown for each article if (is_author()) { //Add the header meta authors for single post echo $this->model->showMeta(); } else { if (ABH_Classes_Tools::getOption('abh_ineachpost') == 1 && count($wp_query->posts) > 1) { $theme = ABH_Classes_Tools::getOption('abh_achposttheme'); $this->show = true; //echo '<pre>' . print_R($wp_query, true) . '</pre>'; } elseif (!isset($this->model->details['abh_use']) || $this->model->details['abh_use']) { $this->show = true; //Add the header meta authors for single post echo $this->model->showMeta(); } } if ($this->show) { // load the theme css and js in header if (file_exists(_ABH_ALL_THEMES_DIR_ . $theme . '/css/frontend.css')) { ABH_Classes_ObjController::getController('ABH_Classes_DisplayController')->loadMedia(_ABH_ALL_THEMES_URL_ . $theme . '/css/frontend.css'); } //load the css and js for frontend if (file_exists(_ABH_ALL_THEMES_DIR_ . $theme . '/js/frontend.js')) { ABH_Classes_ObjController::getController('ABH_Classes_DisplayController')->loadMedia(_ABH_ALL_THEMES_URL_ . $theme . '/js/frontend.js'); } //load the css and js for frontend if (!is_author()) { ABH_Classes_ObjController::getController('ABH_Classes_DisplayController')->loadMedia(_ABH_ALL_THEMES_URL_ . 'admin/css/hidedefault.css'); } //load the css and js for frontend } } }
?> </span> </div> <div id="abh_box_preview_title"><?php _e('Preview mode for the default theme', _ABH_PLUGIN_NAME_); ?> </div> <div id="abh_box_preview"><?php if (file_exists(_ABH_ALL_THEMES_DIR_ . ABH_Classes_Tools::getOption('abh_theme') . '/js/frontend.js')) { echo '<script type="text/javascript" src="' . _ABH_ALL_THEMES_URL_ . ABH_Classes_Tools::getOption('abh_theme') . '/js/frontend.js?ver=' . ABH_VERSION . '"></script>'; } echo '<link rel="stylesheet" href="' . _ABH_ALL_THEMES_URL_ . ABH_Classes_Tools::getOption('abh_theme') . '/css/frontend.css?ver=' . ABH_VERSION . '" type="text/css" media="all" />'; global $current_user; echo ABH_Classes_ObjController::getController('ABH_Controllers_Frontend')->showBox($current_user->ID); ?> </div> <input type="text" style="display: none;" value="<?php echo $current_user->ID; ?> " size="1" id="user_id" > <br /><br /> <div class="abh_option_content"> <div class="abh_select"> <select name="abh_achposttheme"> <?php foreach (ABH_Classes_Tools::getOption('abh_achpostthemes') as $name) { echo '<option value="' . $name . '" ' . (ABH_Classes_Tools::getOption('abh_achposttheme') == $name ? 'selected="selected"' : '') . ' >' . ucfirst($name) . '</option>'; } ?>
/** * Get all core classes from config.xml in core directory * * @param string $for */ public function getBlocks($for) { /* if config allready in cache */ if (!isset(self::$config)) { $config_file = _ABH_CORE_DIR_ . 'config.xml'; if (!file_exists($config_file)) { return; } /* load configuration blocks data from core config files */ $data = file_get_contents($config_file); self::$config = json_decode(json_encode((array) simplexml_load_string($data)), 1); } //print_r(self::$config); if (is_array(self::$config)) { foreach (self::$config['block'] as $block) { if (isset($block['active']) && $block['active'] == 1) { if (isset($block['controllers']['controller'])) { if (!is_array($block['controllers']['controller'])) { /* if the block should load for the current controller */ if ($for == $block['controllers']['controller']) { ABH_Classes_ObjController::getBlock($block['name'])->init(); } } else { foreach ($block['controllers']['controller'] as $controller) { /* if the block should load for the current controller */ if ($for == $controller) { ABH_Classes_ObjController::getBlock($block['name'])->init(); } } } } } } } }