/**
 * 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());
    }
}
Exemplo n.º 2
0
/**
 * Displays a Comment activity wall entry
 *
 * @param array $args Event data.
 * @return string Text to display.
 */
function _aoc_wall_comment($args)
{
    $tdomain = ak_get_object('akucom')->ID;
    if ('insert' == $args['object_action']) {
        $text = sprintf(__('%1$s added a comment to %2$s', $tdomain), aoc_user_anchor($args['owner_id']), '<a href="' . get_permalink($args['object_id']) . '" rel="bookmark">' . get_the_title($args['object_id']) . '</a>');
        return $text;
    } else {
        return $args['event_params']['display'];
    }
}
// ============================================== SHORTCUT FUNCTIONS ==========
/**
 * 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);
}
// ================================================= START PROCEDURE ==========
ak_create_object('akucom_activity', new aocActivity(__FILE__));
Exemplo n.º 3
0
 * @param object $user User object for which we want the image.
 * @param boolean $thumbnail Set to true if want thumbnail instead the large size.
 * @return string HTML format for the img tag and the link to gallery.
 */
function aoc_profile_picture($user, $thumbnail = false)
{
    return ak_get_object('akucom_gallery')->getProfilePicture($user, $thumbnail);
}
/**
 * Returns a User Gallery page.
 * @param string $user_login_or_id Login Name or ID for the user.
 * @return string|false	The formated user gallery or false if the gallery cannot be shown.
 */
function aoc_gallery_content($user_login_or_id)
{
    return ak_get_object('akucom_gallery')->userGalleryContent($user_login_or_id);
}
// ================================================= START PROCEDURE ==========
ak_create_object('akucom_gallery', new aocGallery(__FILE__));
if (ak_get_object('akucom_gallery')->localAvatars()) {
    /**
     * 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);
    }
}
Exemplo n.º 4
0
/**
 * Shortcut to return the roles that can be shown in Community
 * This is an alias of aocProfiles::getAllowedRoles()
 *
 * @see aocProfiles::getAllowedRoles()
 * @return array	The allowed roles.
 */
function aoc_allowed_roles()
{
    return ak_get_object('akucom_profiles')->getAllowedRoles();
}
/**
 * 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;
}
// ================================================= START PROCEDURE ==========
ak_create_object('akucom_profiles', new aocProfiles(__FILE__));
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('AK_CMAN_PATH', dirname(__FILE__));
define('AK_CMAN_LIB', AK_CMAN_PATH . '/includes');
/**
 * Sets an admin warning regarding required PHP version.
 *
 * @hook action 'admin_notices'
 * @return void
 */
function _cman_php_warning()
{
    $data = get_plugin_data(__FILE__);
    load_plugin_textdomain('capsman', false, basename(dirname(__FILE__)) . '/lang');
    echo '<div class="error"><p><strong>' . __('Warning:', 'capsman') . '</strong> ' . sprintf(__('The active plugin %s is not compatible with your PHP version.', 'capsman') . '</p><p>', '&laquo;' . $data['Name'] . ' ' . $data['Version'] . '&raquo;') . sprintf(__('%s is required for this plugin.', 'capsman'), 'PHP-5 ') . '</p></div>';
}
// ============================================ START PROCEDURE ==========
// Check required PHP version.
if (version_compare(PHP_VERSION, '5.0.0', '<')) {
    // Send an armin warning
    add_action('admin_notices', '_cman_php_warning');
} else {
    // Run the plugin
    include_once AK_CMAN_PATH . '/framework/loader.php';
    include AK_CMAN_LIB . '/manager.php';
    ak_create_object('capsman', new CapabilityManager(__FILE__, 'capsman'));
}
Exemplo n.º 6
0
	GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** Path to the plugin folder **/
define('AOC_PATH', dirname(__FILE__));
// ================================================ HELPER FUNCTIONS ==========
/**
 * Sets an admin warning regarding required PHP version.
 *
 * @hook action 'admin_notices'
 * @return void
 */
function _aoc_php_warning()
{
    $data = get_plugin_data(__FILE__);
    load_plugin_textdomain('akucom', false, basename(dirname(__FILE__)) . '/lang');
    echo '<div class="error"><p><strong>' . __('Warning:', 'akucom') . '</strong> ' . sprintf(__('The active plugin %s is not compatible with your PHP version.', 'akucom') . '</p><p>', '&laquo;' . $data['Name'] . ' ' . $data['Version'] . '&raquo;') . sprintf(__('%s is required for this plugin.', 'akucom'), 'PHP 5.2 ') . '</p></div>';
}
// ================================================= START PROCEDURE ==========
// Check required PHP version.
if (version_compare(PHP_VERSION, '5.2.0', '<')) {
    // Send an armin warning
    add_action('admin_notices', '_aoc_php_warning');
} else {
    require_once AOC_PATH . '/framework/loader.php';
    require_once AOC_PATH . '/includes/plugin.php';
    require_once AOC_PATH . '/includes/templates.php';
    ak_create_object('akucom', new Alkivia(__FILE__, 'akucom'));
}
Exemplo n.º 7
0
* @version		$Rev: 903 $
* @author		Jordi Canals
* @copyright   Copyright (C) 2009, 2010 Jordi Canals
* @license		GNU General Public License version 2
* @link		http://alkivia.org
* @package		Alkivia
* @subpackage	Community
*

	Copyright 2009, 2010 Jordi Canals <*****@*****.**>

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	version 2 as published by the Free Software Foundation.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// File cannot be called directly
if (!defined('AOC_PATH')) {
    die('');
    // Silence is gold.
}
require_once dirname(__FILE__) . '/component.php';
ak_create_object('akucom_login_form', new aocLoginForm(__FILE__));