/** * This hook will show the error in WP header */ function hookNotices() { if (is_array(self::$errors)) { foreach (self::$errors as $error) { switch ($error['type']) { case 'fatal': self::showError(ucfirst(_ABH_PLUGIN_NAME_ . " " . $error['type']) . ': ' . $error['text'], $error['id']); die; break; case 'settings': if (ABH_Classes_Tools::getOption('ignore_warn') == 1) { break; } /* switch off option for notifications */ self::$switch_off = "<a href=\"javascript:void(0);\" onclick=\"jQuery.post( ajaxurl, {action: 'abh_warnings_off', nonce: '" . wp_create_nonce('abh_none') . "'}, function(data) { if (data) { jQuery('#abh_ignore_warn').attr('checked', true); jQuery('.abh_message').hide(); jQuery('#toplevel_page_abh .awaiting-mod').fadeOut('slow'); } });\" >" . __("Turn off warnings!", _ABH_PLUGIN_NAME_) . "</a>"; self::showError(ucfirst(_ABH_PLUGIN_NAME_) . " " . __('Notice: ', _ABH_PLUGIN_NAME_) . $error['text'] . " " . self::$switch_off, $error['id']); break; default: self::showError(ucfirst(_ABH_PLUGIN_NAME_) . " " . __('Note: ', _ABH_PLUGIN_NAME_) . $error['text'], $error['id']); } } } self::$errors = array(); }
/** * Get the meta with Social and Profile * @return string */ public function showMeta() { if (!isset($this->author)) { return; } $meta = "\n<!-- StarBox - the Author Box for Humans " . ABH_VERSION . ", visit: http://wordpress.org/plugins/starbox/ -->\n"; if (ABH_Classes_Tools::getOption('abh_showopengraph') == 1 && is_author()) { //Show the OpenGraph $meta .= $this->showOpenGraph(); } if (isset($this->details['abh_google']) && $this->details['abh_google'] != '') { $meta .= $this->showGoogleAuthorMeta(); } //show google author meta if (isset($this->details['abh_facebook']) && $this->details['abh_facebook'] != '') { $meta .= $this->showFacebookAuthorMeta(); } //show facebook author meta $meta .= "<!-- /StarBox - the Author Box for Humans -->\n\n"; return $meta; }
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; } }
/** * 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 class="abh_option_content"> <div class="abh_switch"> <input id="abh_powered_by_on" type="radio" class="abh_switch-input abh_powered_by" name="abh_powered_by" value="1" <?php echo !ABH_Classes_Tools::getOption('abh_powered_by') == 0 ? "checked" : ''; ?> /> <label for="abh_powered_by_on" class="abh_switch-label abh_switch-label-off"><?php _e('Yes', _ABH_PLUGIN_NAME_); ?> </label> <input id="abh_powered_by_off" type="radio" class="abh_switch-input abh_powered_by" name="abh_powered_by" value="0" <?php echo ABH_Classes_Tools::getOption('abh_powered_by') == 0 ? "checked" : ''; ?> /> <label for="abh_powered_by_off" class="abh_switch-label abh_switch-label-on"><?php _e('No', _ABH_PLUGIN_NAME_); ?> </label> <span class="abh_switch-selection"></span> </div> <span><?php _e('Show "Powered by Starbox"', _ABH_PLUGIN_NAME_); ?> </span> </div> </div>
?> </select> </div> <span><?php _e('Choose the size of the description', _ABH_PLUGIN_NAME_); ?> </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>
/** * Hook the Article/Page Content * @global object $post * @param string $content * @return string */ public function hookFrontcontent($content) { global $post; if (!$this->show || isset($this->custom[$post->ID]) && $this->custom[$post->ID] == true) { return $content; } if (ABH_Classes_Tools::getOption('abh_shortcode') == 1) { if (preg_match($this->shortcode, $content)) { $this->custom[$post->ID] = true; return $content; } } $content = $this->showAuthorBox($content); if (ABH_Classes_Tools::getOption('abh_ineachpost') == 1 && $this->box == '') { $post = get_post($post->ID); if (!isset($post->post_author)) { return; } // get the author data $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_use']) || $this->model->details['abh_use'] == 1) { $this->model->single = false; echo $this->model->getAuthorBox(); } } return $content; }
<div><br /><br /><?php _e('Add Starbox in the post content or widgets with the shortcode <strong>[starbox]</strong> or <strong>[starbox id=USER_ID]</strong>', _ABH_PLUGIN_NAME_); ?> </div> <div class="abh_option_content"> <div class="abh_switch"> <input id="abh_shortcode_on" type="radio" class="abh_switch-input" name="abh_shortcode" value="1" <?php echo ABH_Classes_Tools::getOption('abh_shortcode') == 1 ? "checked" : ''; ?> /> <label for="abh_shortcode_on" class="abh_switch-label abh_switch-label-off"><?php _e('Yes', _ABH_PLUGIN_NAME_); ?> </label> <input id="abh_shortcode_off" type="radio" class="abh_switch-input" name="abh_shortcode" value="0" <?php echo !ABH_Classes_Tools::getOption('abh_shortcode') ? "checked" : ''; ?> /> <label for="abh_shortcode_off" class="abh_switch-label abh_switch-label-on"><?php _e('No', _ABH_PLUGIN_NAME_); ?> </label> <span class="abh_switch-selection"></span> </div> <span><?php echo sprintf(__('Check for <strong>[starbox]</strong> shortcode in my blog. %sRead more >>%s', _ABH_PLUGIN_NAME_), '<a href="http://wordpress.org/plugins/starbox/faq/" target="_blank">', '</a>'); ?> </span> </div> </fieldset>