当前位置: 首页>>代码示例>>PHP>>正文


PHP update_subtype函数代码示例

本文整理汇总了PHP中update_subtype函数的典型用法代码示例。如果您正苦于以下问题:PHP update_subtype函数的具体用法?PHP update_subtype怎么用?PHP update_subtype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了update_subtype函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: questions_init

function questions_init()
{
    elgg_register_library("elgg:questions", dirname(__FILE__) . "/lib/questions.php");
    add_subtype("object", 'question', 'ElggQuestion');
    update_subtype("object", 'question', 'ElggQuestion');
    add_subtype("object", 'answer', 'ElggAnswer');
    update_subtype("object", 'answer', 'ElggAnswer');
    elgg_extend_view("css/elgg", "questions/css");
    elgg_extend_view("js/elgg", "questions/js");
    elgg_register_menu_item("site", array("name" => 'questions', "text" => elgg_echo('questions'), "href" => "/questions/all"));
    elgg_register_entity_type("object", 'questions');
    elgg_register_widget_type('questions', elgg_echo("widget:questions:title"), elgg_echo("widget:questions:description"));
    $actions_base = dirname(__FILE__) . '/actions/object/question';
    elgg_register_action("object/question/save", "{$actions_base}/save.php");
    elgg_register_action("questions/delete", "{$actions_base}/delete.php");
    $actions_base = dirname(__FILE__) . '/actions/object/answer';
    elgg_register_action("object/answer/save", "{$actions_base}/save.php");
    elgg_register_entity_url_handler('object', 'question', 'questions_url_handler');
    $plugin_dir = dirname(__FILE__);
    elgg_register_entity_url_handler('object', 'answer', 'answers_url');
    elgg_register_page_handler('questions', 'questions_page_handler');
    elgg_register_page_handler('answers', 'answers_page_handler');
    $actions_base = "{$plugin_dir}/actions/object/answer";
    elgg_register_action('object/answer/add', "{$actions_base}/save.php");
    elgg_register_action('object/answer/edit', "{$actions_base}/save.php");
    elgg_register_action('answers/delete', "{$actions_base}/delete.php");
    elgg_register_plugin_hook_handler("register", "menu:owner_block", 'questions_owner_block_menu_handler');
    elgg_register_plugin_hook_handler("register", "menu:user_hover", 'questions_user_hover_menu_handler');
    elgg_register_plugin_hook_handler("register", 'menu:entity', 'questions_entity_menu_handler');
    elgg_register_plugin_hook_handler("notify:entity:message", "object", 'questions_notify_message_handler');
    add_group_tool_option('questions', elgg_echo("questions:enable"), true);
    elgg_extend_view("groups/tool_latest", "questions/group_module");
    elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'questions_container_permissions_check');
}
开发者ID:remy40,项目名称:gvrs,代码行数:34,代码来源:start.php

示例2: setGroupMailClassHandler

 /**
  * Set the correct class for the GroupMail subtype
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param mixed  $object supplied object
  *
  * @return void
  */
 public static function setGroupMailClassHandler($event, $type, $object)
 {
     if (get_subtype_id('object', \GroupMail::SUBTYPE)) {
         update_subtype('object', \GroupMail::SUBTYPE, 'GroupMail');
     } else {
         add_subtype('object', \GroupMail::SUBTYPE, 'GroupMail');
     }
 }
开发者ID:coldtrick,项目名称:group_tools,代码行数:17,代码来源:Upgrade.php

示例3: setClassHandler

 /**
  * Listen to the upgrade event to set the correct class handler
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param null   $object supplied param
  *
  * @return void
  */
 public static function setClassHandler($event, $type, $object)
 {
     if (get_subtype_id('object', \CSVExport::SUBTYPE)) {
         update_subtype('object', \CSVExport::SUBTYPE, 'CSVExport');
     } else {
         add_subtype('object', \CSVExport::SUBTYPE, 'CSVExport');
     }
 }
开发者ID:coldtrick,项目名称:csv_exporter,代码行数:17,代码来源:Upgrade.php

示例4: user_support_faq_class_update

/**
* This function adds a class handler to object->faq
* Since the old FAQ didn't had a class
*
* @return bool
*/
function user_support_faq_class_update()
{
    $class = get_subtype_class("object", UserSupportFAQ::SUBTYPE);
    if ($class != "UserSupportFAQ") {
        return update_subtype("object", UserSupportFAQ::SUBTYPE, "UserSupportFAQ");
    }
    return true;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:14,代码来源:run_once.php

示例5: setClassHandler

 /**
  * Update the class for publication subtype
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param mixed  $object supplied params
  *
  * @return void
  */
 public static function setClassHandler($event, $type, $object)
 {
     // set correct class handler for Publication
     if (get_subtype_id('object', \Publication::SUBTYPE)) {
         update_subtype('object', \Publication::SUBTYPE, 'Publication');
     } else {
         add_subtype('object', \Publication::SUBTYPE, 'Publication');
     }
 }
开发者ID:Beaufort8,项目名称:elgg-publication,代码行数:18,代码来源:Upgrade.php

示例6: fixClasses

 public static function fixClasses($event, $type, $object)
 {
     $classes = ['\\ColdTrick\\EventManager\\Event\\Day', '\\ColdTrick\\EventManager\\Event\\Slot'];
     foreach ($classes as $class) {
         if (get_subtype_class('object', $class::SUBTYPE) !== $class) {
             update_subtype('object', $class::SUBTYPE, $class);
         }
     }
 }
开发者ID:coldtrick,项目名称:event_manager,代码行数:9,代码来源:Upgrade.php

示例7: setClassHandler

 /**
  * Make sure the class handler for QuickLink is correct
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param mixed  $object misc params
  *
  * @return void
  */
 public static function setClassHandler($event, $type, $object)
 {
     // set correct class handler for QuickLink
     if (get_subtype_id('object', \QuickLink::SUBTYPE)) {
         update_subtype('object', \QuickLink::SUBTYPE, 'QuickLink');
     } else {
         add_subtype('object', \QuickLink::SUBTYPE, 'QuickLink');
     }
 }
开发者ID:coldtrick,项目名称:quicklinks,代码行数:18,代码来源:Upgrade.php

示例8: profile_manager_plugins_boot

/**
 * Performs class upgrade before init as classes are needed during init
 *
 * @return void
 */
function profile_manager_plugins_boot()
{
    $classes = ['\\ColdTrick\\ProfileManager\\CustomProfileField', '\\ColdTrick\\ProfileManager\\CustomGroupField', '\\ColdTrick\\ProfileManager\\CustomProfileType', '\\ColdTrick\\ProfileManager\\CustomFieldCategory'];
    foreach ($classes as $class) {
        $current_class = get_subtype_class('object', $class::SUBTYPE);
        if ($current_class !== $class) {
            update_subtype('object', $class::SUBTYPE, $class);
        }
    }
}
开发者ID:coldtrick,项目名称:profile_manager,代码行数:15,代码来源:start.php

示例9: upgrade_1395096061

function upgrade_1395096061()
{
    $subtypes = array(HYPEGAMEMECHANICS_BADGE_SUBTYPE, HYPEGAMEMECHANICS_BADGERULE_SUBTYPE, HYPEGAMEMECHANICS_SCORE_SUBTYPE);
    foreach ($subtypes as $subtype) {
        if (get_subtype_id('object', $subtype)) {
            update_subtype('object', $subtype);
        } else {
            add_subtype('object', $subtype);
        }
    }
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:11,代码来源:upgrade.php

示例10: haarlem_tangram_upgrade

/**
 * Listen to the upgrade event
 *
 * @param string $event  the name of the event
 * @param string $type   the type of the event
 * @param mixed  $object supplied params
 */
function haarlem_tangram_upgrade($event, $type, $object)
{
    // register correct class for future use
    if (get_subtype_id('object', TangramVacancy::SUBTYPE)) {
        update_subtype('object', TangramVacancy::SUBTYPE, 'TangramVacancy');
    } else {
        add_subtype('object', TangramVacancy::SUBTYPE, 'TangramVacancy');
    }
    // reset xml cache
    haarlem_tangram_clear_cached_xml();
}
开发者ID:coldtrick,项目名称:haarlem_tangram,代码行数:18,代码来源:events.php

示例11: wizard_upgrade_system_handler

/**
 * Listen to upgrade event
 *
 * @param string $event  the name of the event
 * @param string $type   the type of the event
 * @param mixed  $object supplied params
 *
 * @return void
 */
function wizard_upgrade_system_handler($event, $type, $object)
{
    $id = get_subtype_id('object', Wizard::SUBTYPE);
    if (empty($id)) {
        // add subtype registration
        add_subtype('object', Wizard::SUBTYPE, 'Wizard');
    } elseif (get_subtype_class_from_id($id) !== 'Wizard') {
        // update subtype registration
        update_subtype('object', Wizard::SUBTYPE, 'Wizard');
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:20,代码来源:events.php

示例12: checkClasses

 /**
  * Check the class assosiation
  *
  * @param string $event  the name of the event
  * @param string $type   the type of the event
  * @param mixed  $object supplied params
  *
  * @return void
  */
 public static function checkClasses($event, $type, $object)
 {
     if (get_subtype_id('object', \APIApplication::SUBTYPE)) {
         update_subtype('object', \APIApplication::SUBTYPE, 'APIApplication');
     } else {
         add_subtype('object', \APIApplication::SUBTYPE, 'APIApplication');
     }
     if (get_subtype_id('object', \APIApplicationUserSetting::SUBTYPE)) {
         update_subtype('object', \APIApplicationUserSetting::SUBTYPE, 'APIApplicationUserSetting');
     } else {
         add_subtype('object', \APIApplicationUserSetting::SUBTYPE, 'APIApplicationUserSetting');
     }
 }
开发者ID:coldtrick,项目名称:ws_pack,代码行数:22,代码来源:Upgrade.php

示例13: widget_manager_init

function widget_manager_init()
{
    // check valid WidgetManagerWidget class
    if (get_subtype_class("object", "widget") == "ElggWidget") {
        update_subtype("object", "widget", "WidgetManagerWidget");
    }
    elgg_trigger_event("widgets_init", "widget_manager");
    if (elgg_is_active_plugin("groups") && elgg_get_plugin_setting("group_enable", "widget_manager") == "yes") {
        // add the widget manager tool option
        $group_option_enabled = false;
        if (elgg_get_plugin_setting("group_option_default_enabled", "widget_manager") == "yes") {
            $group_option_enabled = true;
        }
        if (elgg_get_plugin_setting("group_option_admin_only", "widget_manager") != "yes") {
            // add the tool option for group admins
            add_group_tool_option('widget_manager', elgg_echo('widget_manager:groups:enable_widget_manager'), $group_option_enabled);
        } elseif (elgg_is_admin_logged_in()) {
            add_group_tool_option('widget_manager', elgg_echo('widget_manager:groups:enable_widget_manager'), $group_option_enabled);
        } elseif ($group_option_enabled) {
            // register event to make sure newly created groups have the group option enabled
            elgg_register_event_handler("create", "group", "widget_manager_create_group_event_handler");
            elgg_register_plugin_hook_handler('get_list', 'default_widgets', 'widget_manager_group_widgets_default_list');
        }
    }
    // extend CSS
    elgg_extend_view("css/elgg", "widget_manager/css/global");
    elgg_extend_view("css/admin", "widget_manager/css/global");
    elgg_extend_view("js/elgg", "widget_manager/js/site");
    elgg_extend_view("js/admin", "widget_manager/js/admin");
    // register a widget title url handler
    elgg_register_entity_url_handler("object", "widget", "widget_manager_widget_url_handler");
    // multi dashboard support
    add_subtype("object", MultiDashboard::SUBTYPE, "MultiDashboard");
    if (elgg_is_logged_in() && widget_manager_multi_dashboard_enabled()) {
        elgg_register_page_handler("multi_dashboard", "widget_manager_multi_dashboard_page_handler");
        $options = array("type" => "object", "subtype" => MultiDashboard::SUBTYPE, "owner_guid" => elgg_get_logged_in_user_guid(), "count" => true);
        $tab_count = elgg_get_entities($options);
        if ($tab_count < MULTI_DASHBOARD_MAX_TABS) {
            elgg_register_menu_item("extras", array("name" => "multi_dashboard", "text" => elgg_view_icon("home"), "href" => "multi_dashboard/edit/?internal_url=" . urlencode(current_page_url()), "title" => elgg_echo("widget_manager:multi_dashboard:extras"), "rel" => "nofollow", "id" => "widget-manager-multi_dashboard-extras"));
        }
        elgg_extend_view("page/elements/sidebar", "widget_manager/multi_dashboard/sidebar", 400);
        elgg_register_event_handler("create", "object", "widget_manager_create_object_handler");
        elgg_register_plugin_hook_handler("route", "dashboard", "widget_manager_dashboard_route_handler");
        elgg_register_plugin_hook_handler("action", "widgets/add", "widget_manager_widgets_add_action_handler");
        elgg_register_action("multi_dashboard/edit", dirname(__FILE__) . "/actions/multi_dashboard/edit.php");
        elgg_register_action("multi_dashboard/delete", dirname(__FILE__) . "/actions/multi_dashboard/delete.php");
        elgg_register_action("multi_dashboard/drop", dirname(__FILE__) . "/actions/multi_dashboard/drop.php");
        elgg_register_action("multi_dashboard/reorder", dirname(__FILE__) . "/actions/multi_dashboard/reorder.php");
    }
}
开发者ID:amcfarlane1251,项目名称:portal,代码行数:50,代码来源:start.php

示例14: hj_forum_1358206168

function hj_forum_1358206168()
{
    $subtypes = array('hjforum' => 'hjForum', 'hjforumcategory' => 'hjForumCategory', 'hjforumtopic' => 'hjForumTopic', 'hjforumpost' => 'hjForumPost');
    foreach ($subtypes as $subtype => $class) {
        if (get_subtype_id('object', $subtype)) {
            update_subtype('object', $subtype, $class);
        } else {
            add_subtype('object', $subtype, $class);
        }
    }
    $subtypeIdForum = get_subtype_id('object', 'hjforum');
    $subtypeIdForumTopic = get_subtype_id('object', 'hjforumtopic');
    $subtypeIdAnnotation = get_subtype_id('object', 'hjannotation');
    $dbprefix = elgg_get_config('dbprefix');
    $segments = elgg_get_entities_from_metadata(array('types' => 'object', 'subtypes' => 'hjsegment', 'metadata_name_value_pairs' => array('name' => 'handler', 'value' => 'hjforumtopic'), 'limit' => 0));
    /**
     * Upgrade :
     * 1. Convert segmented hjForumTopic objects to hjForum objects
     * 2. Remove segments
     * 3. Convert widgets to categories
     */
    foreach ($segments as $segment) {
        $forum = get_entity($segment->container_guid);
        $query = "UPDATE {$dbprefix}entities SET subtype = {$subtypeIdForum} WHERE subtype = {$subtypeIdForumTopic} AND guid = {$forum->guid}";
        update_data($query);
        $widgets = elgg_get_entities(array('types' => 'object', 'subtypes' => 'widget', 'container_guids' => array($segment->guid, $forum->guid), 'limit' => 0));
        if ($widgets) {
            $forum->enable_subcategories = true;
            foreach ($widgets as $widget) {
                $threads = elgg_get_entities_from_metadata(array('types' => 'object', 'subtypes' => 'hjforumtopic', 'metadata_name_value_pairs' => array(array('name' => 'widget', 'value' => $widget->guid)), 'limit' => 0));
                $cat = new ElggObject();
                $cat->subtype = 'hjforumcategory';
                $cat->owner_guid = elgg_get_logged_in_user_guid();
                $cat->container_guid = $forum->guid;
                $cat->title = $widget->title;
                $cat->description = '';
                $cat->access_id = ACCESS_PUBLIC;
                $cat->save();
                foreach ($threads as $thread) {
                    $query = "UPDATE {$dbprefix}entities SET container_guid = {$forum->guid} WHERE guid = {$thread->guid}";
                    update_data($query);
                    unset($thread->widget);
                    $thread->setCategory($cat->guid, true);
                }
                $widget->disable('plugin_version_upgrade');
            }
        }
        $segment->disable('plugin_version_upgrade');
    }
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:50,代码来源:upgrade.php

示例15: newsletter_upgrade_event_handler

/**
 * Do something on the 'upgrade', 'system' event (when running upgrade.php)
 *
 * @param string $event  which event was triggered
 * @param string $type   what is the type of the event
 * @param mixed  $object On what object was the event triggered
 *
 * @return void
 *
 * @see elgg_trigger_event()
 */
function newsletter_upgrade_event_handler($event, $type, $object)
{
    // amke sure the correct classes are set for our own classes
    if (!update_subtype("object", Newsletter::SUBTYPE, "Newsletter")) {
        // first time the plugin was activated
        add_subtype("object", Newsletter::SUBTYPE, "Newsletter");
    }
    if (!update_subtype("object", NewsletterSubscription::SUBTYPE, "NewsletterSubscription")) {
        // first time the plugin was activated
        add_subtype("object", NewsletterSubscription::SUBTYPE, "NewsletterSubscription");
    }
    // proccess upgrade scripts
    $upgrade_scripts = array();
    $upgrade_dir = dirname(__FILE__) . "/upgrades/";
    $fh = opendir($upgrade_dir);
    // read all available upgrade scripts
    if (!empty($fh)) {
        while (($upgrade_file = readdir($fh)) !== false) {
            if (!is_dir($upgrade_dir . $upgrade_file)) {
                $upgrade_scripts[] = $upgrade_file;
            }
        }
        closedir($fh);
    }
    if (!empty($upgrade_scripts)) {
        // get already run scripts
        $upgrades = datalist_get("processed_upgrades");
        $processed_upgrades = unserialize($upgrades);
        if (!is_array($processed_upgrades)) {
            $processed_upgrades = array();
        }
        // do we have something left
        $unprocessed = array_diff($upgrade_scripts, $processed_upgrades);
        if (!empty($unprocessed)) {
            // proccess all upgrades
            foreach ($unprocessed as $script) {
                include $upgrade_dir . $script;
                $processed_upgrades[] = $script;
            }
            // save new list
            elgg_set_processed_upgrades($processed_upgrades);
        }
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:55,代码来源:events.php


注:本文中的update_subtype函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。