/** * Class constructor. * @see WP_Widget::__construct() */ public final function __construct() { $this->PID = ak_get_object('akucom')->ID; // Translation textdomain. $this->widgetLoad(); parent::__construct($this->wID, $this->wTitle, $this->wOptions); }
/** * Returns the 'settings' object reference. * * @return object|false Returns the object reference, or false if not found. */ function &ak_settings_object() { if (ak_object_exists('settings')) { return ak_get_object('settings'); } else { return ak_create_object('settings', new akSettings()); } }
/** * Returns a list of arrays for activity items. * * @see aocActivity::getTheWall() * @param $owner_id User id to get the activity from. If 0, will return flobal activity. * @return array List of activity items */ function aoc_get_wall_items($user_id) { return ak_get_object('akucom_activity')->getTheWall($user_id); }
/** * Loads module data and settings. * Data is loaded from the module file headers. Settings from Database and alkivia.ini. * * @return void */ private final function loadModuleData($id) { $this->loadData(); switch ($this->mod_type) { case self::PLUGIN: $this->mod_url = WP_PLUGIN_URL . '/' . basename(dirname($this->mod_file)); $this->ID = empty($id) ? strtolower(basename($this->mod_file, '.php')) : trim($id); break; case self::THEME: case self::CHILD_THEME: $this->mod_url = get_stylesheet_directory_uri(); $this->ID = empty($id) ? strtolower(basename(TEMPLATEPATH)) : trim($id); break; case self::COMPONENT: $this->mod_url = ak_get_object($this->PID)->getUrl() . 'components/' . basename(dirname($this->mod_file)); $this->ID = $this->PID . '_' . $this->child_data['Component']; break; } $this->cfg->setDefaults($this->ID, $this->defaultOptions()); $old_version = get_option($this->ID . '_version'); if (false === $old_version) { $this->installing = true; } elseif (version_compare($old_version, $this->version, 'ne')) { $this->needs_update = true; } }
/** * Just to replace the get_avatar() function from WordPress. * * @see get_avatar() from WordPress core. * @return string <img> tag for the avatar image if there is one. */ function get_avatar($id_or_email, $size = 80, $default = '') { return ak_get_object('akucom_gallery')->getAvatar($id_or_email, $size, $default); }
</ul> <?php } ?> </ul> </div> <div id="profile-right"> <ul> <li><h2><?php _e('Activity Wall', $i18n); ?> </h2></li> <li><ul id="wall"> <?php if (ak_get_object('akucom')->activeComponent('activity')) { $items = aoc_get_wall_items($user->ID); foreach ($items as $item) { echo '<li><p>' . $item['avatar']; echo '<span class="datetime">' . ak_time_ago($item['date'], $i18n) . '</span><br />' . $item['text'] . '</p></li>'; } } ?> </ul></li> </ul> </div> <div style="clear:both;"></div> </div> <br/><div class="navigator bottom_navigator"><div class="navleft"><?php
/** * Loads component data. * As it is a child component, data is loaded into akModuleAbstract::child_data * * @return void */ protected final function loadData() { if (empty($this->child_data)) { $component_data = ak_component_data($this->mod_file, true); $readme_data = ak_module_readme_data($this->mod_file); $this->child_data = array_merge($readme_data, $component_data); $this->PID = $this->child_data['Parent']; $this->mod_data = ak_get_object($this->PID)->getModData(); if (empty($this->child_data['Version'])) { $this->version = $this->mod_data['Version']; } else { $this->version = $this->child_data['Version']; } } }
/** * Creates the base link to a community page. * Alias of Alkivia::createLink() * * @see Alkivia::createLink() * @param string $var Name of the variable * @param mixed $value Value for the variable * @return string Base link to the requeste page/var */ function aoc_create_link($var, $value = '') { return ak_get_object('akucom')->createLink($var, $value); }
?> <h3 class="alkivia-admin-link"><?php echo $edit_link; ?> </h3> <?php } ?> <div class="profile-box"> <h1 class="profile-name"><?php echo $user->display_name; ?> </h1> <?php if (ak_get_object('akucom')->activeComponent('gallery')) { echo '<div class="left-side">' . aoc_profile_picture($user, true) . '</div>'; } if (!empty($user->description)) { ?> <h2><?php _e('About me', $i18n); ?> </h2> <?php echo wpautop($user->description); ?> <?php } ?> <div style="clear:both;"></div>
/** * Returns a subquery string to select users from allowed roles. * * @uses aocProfiles::getAllowedRoles() * @return string The select subquery. */ function aoc_roles_subquery() { global $wpdb; $keys = array(); $roles = ak_get_object('akucom_profiles')->getAllowedRoles(); foreach ($roles as $value) { $keys[] = "meta_value LIKE '%{$value}%'"; } $subquery = "SELECT * FROM {$wpdb->usermeta} INNER JOIN {$wpdb->users} " . "ON {$wpdb->usermeta}.user_id = {$wpdb->users}.id " . "WHERE meta_key='{$wpdb->prefix}capabilities' AND (" . implode(' OR ', $keys) . ")"; return $subquery; }
/** * Copyright, authoring and versions for admin pages footer. * * @since 0.5 * * @param string $mod_id Module ID * @param int $year First copyrigh year. * @return void */ function ak_admin_footer($mod_id, $year = 2009) { $mod = ak_get_object($mod_id); if (!$mod) { return; } $data = $mod->getModData(); if ($mod->isPlugin() || $mod->isComponent()) { echo '<p class="footer"><a href="' . $mod->getModData('PluginURI') . '">' . $mod->getModData('Name') . ' ' . $mod->getModData('Version') . '</a> © Copyright '; if (2010 != $year) { echo $year . '-'; } echo date('Y') . ' ' . $mod->getModData('Author'); } elseif ($mod->isTheme()) { echo '<p class="footer"><a href="' . $mod->getModData('URI') . '">' . $mod->getModData('Name') . ' ' . $mod->getModData('Version') . '</a> © Copyright '; if (2010 != $year) { echo $year . '-'; } echo date('Y') . ' '; echo $mod->getModData('Author'); } echo '<br />Framework Version: ' . get_option('ak_framework_version'); if ($mod->isChildTheme()) { echo ' - Child theme: ' . $mod->getChildData('Name') . ' ' . $mod->getChildData('Version'); } if ($mod->isComponent()) { echo ' - Component: ' . $mod->getChildData('Name') . ' ' . $mod->getChildData('Version'); } echo '</p>'; }
/** * Creates the needed rewrite rules for user profiles. * * @hook filter 'generate_rewrite_rules' * @param object $wp_rewrite Current rewrite rules. Received by ref. * @return void */ function rewriteRules(&$wp_rewrite) { $pid = ak_get_object($this->PID)->getOption('page_id'); $slug = basename(get_page_uri($pid)); $rules = array($slug . '/user/(.+)/?$' => 'index.php?page_id=' . $pid . '&user='******'(.+)/' . $slug . '/user/(.+)/?$' => 'index.php?page_id=' . $pid . '&user='******'/page/(.+)/?' => 'index.php?page_id=' . $pid . '&page=' . $wp_rewrite->preg_index(1), '(.+)/' . $slug . '/page/(.+)/?$' => 'index.php?page_id=' . $pid . '&page=' . $wp_rewrite->preg_index(2)); $wp_rewrite->rules = $rules + $wp_rewrite->rules; }
/** * Returns all info about the logo image. * * @return array Image information. With this indexes: * - url: The full url to the image. * - width: Image width. * - height: Image height * - html: The <img> tag for the image. */ private function getLogo() { $upload = wp_upload_dir(); $file = trailingslashit($upload['basedir']) . 'alkivia/login.png'; $logo = array(); if (file_exists($file)) { $logo['url'] = trailingslashit($upload['baseurl']) . 'alkivia/login.png'; } else { $logo['url'] = ak_get_object($this->PID)->getURL() . 'images/login.png'; $file = AOC_PATH . '/images/login.png'; } $info = getimagesize($file); $logo['width'] = $info[0]; $logo['height'] = $info[1]; $logo['html'] = '<img src="' . $logo['url'] . '?' . rand() . '" border="0" ' . $info[3] . ' />'; return $logo; }
/** * Load images dimensions from WordPress and Plugin options. * * @return void */ private function loadSizes() { $settings = ak_get_object('akucom_gallery')->getOption(); $this->settings = $settings; if (2 == $settings['large']) { // Custom Settings $this->img_width = (int) $settings['large_w']; $this->img_height = (int) $settings['large_h']; } else { // WordPress Settings $this->img_width = (int) get_option('large_size_w'); $this->img_height = (int) get_option('large_size_h'); } if (2 == $settings['thumb']) { // Custom Settings $this->thumb_width = (int) $settings['thumb_w']; $this->thumb_height = (int) $settings['thumb_h']; $this->thumb_crop = $settings['thumb_crop'] ? true : false; } else { // WordPress Settings $this->thumb_width = (int) get_option('thumbnail_size_w'); $this->thumb_height = (int) get_option('thumbnail_size_h'); $this->thumb_crop = 1 == get_option('thumbnail_crop') ? true : false; } }
/** * Gets the img tag for the anonymous thumbnail. * * @param string $class CSS class name. * @return string <img> tag for the image. */ private function anonymousThumbnail($class = '') { $a_class = empty($class) ? '' : ' class="' . $class . '"'; $file = AOC_PATH . '/images/anonymous.thumb.png'; $size = $this->getImageSize('thumb', $file); $url = ak_get_object($this->PID)->getURL() . '/images/anonymous.thumb.png'; $image = sprintf('<img src="%s" width="%d" height="%d" title="%s" alt="%s" %s />', $url, $size['width'], $size['height'], 'Anonymous', 'Anonymous', $a_class); return $image; }