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


PHP PluginHost::load_all方法代码示例

本文整理汇总了PHP中PluginHost::load_all方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginHost::load_all方法的具体用法?PHP PluginHost::load_all怎么用?PHP PluginHost::load_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginHost的用法示例。


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

示例1: array

            $filter["action"] = array(json_encode(array("action_id" => $line["action_id"], "action_param_label" => $line["action_param"], "action_param" => $line["action_param"])));
            // Oh god it's full of hacks
            $_REQUEST = $filter;
            $_SESSION["uid"] = $owner_uid;
            $filters = new Pref_Filters($link, $_REQUEST);
            $filters->add();
        }
    }
}
if (in_array("-force-update", $op)) {
    _debug("marking all feeds as needing update...");
    db_query($link, "UPDATE ttrss_feeds SET last_update_started = '1970-01-01',\n\t\t\t\tlast_updated = '1970-01-01'");
}
if (in_array("-list-plugins", $op)) {
    $tmppluginhost = new PluginHost($link);
    $tmppluginhost->load_all($tmppluginhost::KIND_ALL);
    $enabled = array_map("trim", explode(",", PLUGINS));
    echo "List of all available plugins:\n";
    foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
        $about = $plugin->about();
        $status = $about[3] ? "system" : "user";
        if (in_array($name, $enabled)) {
            $name .= "*";
        }
        printf("%-50s %-10s v%.2f (by %s)\n%s\n\n", $name, $status, $about[0], $about[2], $about[1]);
    }
    echo "Plugins marked by * are currently enabled for all users.\n";
}
$pluginhost->run_commands($op);
db_close($link);
if ($lock_handle != false) {
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-1,代码行数:31,代码来源:update.php

示例2: PluginHost

 static function create_published_article($title, $url, $content, $labels_str, $owner_uid)
 {
     $guid = 'SHA1:' . sha1("ttshared:" . $url . $owner_uid);
     // include owner_uid to prevent global GUID clash
     if (!$content) {
         $pluginhost = new PluginHost();
         $pluginhost->load_all(PluginHost::KIND_ALL, $owner_uid);
         $pluginhost->load_data();
         $af_readability = $pluginhost->get_plugin("Af_Readability");
         if ($af_readability) {
             $enable_share_anything = $pluginhost->get($af_readability, "enable_share_anything");
             if ($enable_share_anything) {
                 $extracted_content = $af_readability->extract_content($url);
                 if ($extracted_content) {
                     $content = db_escape_string($extracted_content);
                 }
             }
         }
     }
     $content_hash = sha1($content);
     if ($labels_str != "") {
         $labels = explode(",", $labels_str);
     } else {
         $labels = array();
     }
     $rc = false;
     if (!$title) {
         $title = $url;
     }
     if (!$title && !$url) {
         return false;
     }
     if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) {
         return false;
     }
     db_query("BEGIN");
     // only check for our user data here, others might have shared this with different content etc
     $result = db_query("SELECT id FROM ttrss_entries, ttrss_user_entries WHERE\n\t\t\tguid = '{$guid}' AND ref_id = id AND owner_uid = '{$owner_uid}' LIMIT 1");
     if (db_num_rows($result) != 0) {
         $ref_id = db_fetch_result($result, 0, "id");
         $result = db_query("SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\tref_id = '{$ref_id}' AND owner_uid = '{$owner_uid}' LIMIT 1");
         if (db_num_rows($result) != 0) {
             $int_id = db_fetch_result($result, 0, "int_id");
             db_query("UPDATE ttrss_entries SET\n\t\t\t\t\tcontent = '{$content}', content_hash = '{$content_hash}' WHERE id = '{$ref_id}'");
             db_query("UPDATE ttrss_user_entries SET published = true,\n\t\t\t\t\t\tlast_published = NOW() WHERE\n\t\t\t\t\t\tint_id = '{$int_id}' AND owner_uid = '{$owner_uid}'");
         } else {
             db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t(ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache,\n\t\t\t\t\t\tlast_read, note, unread, last_published)\n\t\t\t\t\tVALUES\n\t\t\t\t\t('{$ref_id}', '', NULL, NULL, {$owner_uid}, true, '', '', NOW(), '', false, NOW())");
         }
         if (count($labels) != 0) {
             foreach ($labels as $label) {
                 label_add_article($ref_id, trim($label), $owner_uid);
             }
         }
         $rc = true;
     } else {
         $result = db_query("INSERT INTO ttrss_entries\n\t\t\t\t(title, guid, link, updated, content, content_hash, date_entered, date_updated)\n\t\t\t\tVALUES\n\t\t\t\t('{$title}', '{$guid}', '{$url}', NOW(), '{$content}', '{$content_hash}', NOW(), NOW())");
         $result = db_query("SELECT id FROM ttrss_entries WHERE guid = '{$guid}'");
         if (db_num_rows($result) != 0) {
             $ref_id = db_fetch_result($result, 0, "id");
             db_query("INSERT INTO ttrss_user_entries\n\t\t\t\t\t(ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache,\n\t\t\t\t\t\tlast_read, note, unread, last_published)\n\t\t\t\t\tVALUES\n\t\t\t\t\t('{$ref_id}', '', NULL, NULL, {$owner_uid}, true, '', '', NOW(), '', false, NOW())");
             if (count($labels) != 0) {
                 foreach ($labels as $label) {
                     label_add_article($ref_id, trim($label), $owner_uid);
                 }
             }
             $rc = true;
         }
     }
     db_query("COMMIT");
     return $rc;
 }
开发者ID:kucrut,项目名称:tt-rss,代码行数:71,代码来源:article.php

示例3: index


//.........这里部分代码省略.........
     print "<button dojoType=\"dijit.form.Button\" onclick=\"return editProfiles()\">" . __('Manage profiles') . "</button> ";
     print "<button dojoType=\"dijit.form.Button\" onclick=\"return validatePrefsReset()\">" . __('Reset to defaults') . "</button>";
     print "&nbsp;";
     /* $checked = $_SESSION["prefs_show_advanced"] ? "checked='1'" : "";
     
     		print "<input onclick='toggleAdvancedPrefs()'
     				id='prefs_show_advanced'
     				dojoType=\"dijit.form.CheckBox\"
     				$checked
     				type=\"checkbox\"></input>
     				<label for='prefs_show_advanced'>" .
     				__("Show additional preferences") . "</label>"; */
     PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION, "hook_prefs_tab_section", "prefPrefsPrefsOutside");
     print "</form>";
     print '</div>';
     # inner pane
     print '</div>';
     # border container
     print "</div>";
     #pane
     print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"" . __('Plugins') . "\">";
     print "<p>" . __("You will need to reload Tiny Tiny RSS for plugin changes to take effect.") . "</p>";
     print_notice(__("Download more plugins at tt-rss.org <a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/forum/viewforum.php?f=22\">forums</a> or <a target=\"_blank\" class=\"visibleLink\" href=\"http://tt-rss.org/wiki/Plugins\">wiki</a>."));
     print "<form dojoType=\"dijit.form.Form\" id=\"changePluginsForm\">";
     print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">\n\t\tevt.preventDefault();\n\t\tif (this.validate()) {\n\t\t\tnotify_progress('Saving data...', true);\n\n\t\t\tnew Ajax.Request('backend.php', {\n\t\t\t\tparameters: dojo.objectToQuery(this.getValues()),\n\t\t\t\tonComplete: function(transport) {\n\t\t\t\t\tnotify('');\n\t\t\t\t\tif (confirm(__('Selected plugins have been enabled. Reload?'))) {\n\t\t\t\t\t\twindow.location.reload();\n\t\t\t\t\t}\n\t\t\t} });\n\n\t\t}\n\t\t</script>";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-prefs\">";
     print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"setplugins\">";
     print "<table width='100%' class='prefPluginsList'>";
     print "<tr><td colspan='4'><h3>" . __("System plugins") . "</h3></td></tr>";
     print "<tr class=\"title\">\n\t\t\t\t<td width=\"5%\">&nbsp;</td>\n\t\t\t\t<td width='10%'>" . __('Plugin') . "</td>\n\t\t\t\t<td width=''>" . __('Description') . "</td>\n\t\t\t\t<td width='5%'>" . __('Version') . "</td>\n\t\t\t\t<td width='10%'>" . __('Author') . "</td></tr>";
     $system_enabled = array_map("trim", explode(",", PLUGINS));
     $user_enabled = array_map("trim", explode(",", get_pref("_ENABLED_PLUGINS")));
     $tmppluginhost = new PluginHost();
     $tmppluginhost->load_all($tmppluginhost::KIND_ALL, $_SESSION["uid"]);
     $tmppluginhost->load_data(true);
     foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
         $about = $plugin->about();
         if ($about[3] && strpos($name, "example") === FALSE) {
             if (in_array($name, $system_enabled)) {
                 $checked = "checked='1'";
             } else {
                 $checked = "";
             }
             print "<tr>";
             print "<td align='center'><input disabled='1'\n\t\t\t\t\t\tdojoType=\"dijit.form.CheckBox\" {$checked}\n\t\t\t\t\t\ttype=\"checkbox\"></td>";
             $plugin_icon = $checked ? "plugin.png" : "plugin_disabled.png";
             print "<td><label><img src='images/{$plugin_icon}' alt=''> {$name}</label></td>";
             print "<td>" . htmlspecialchars($about[1]);
             if (@$about[4]) {
                 print " &mdash; <a target=\"_blank\" class=\"visibleLink\"\n\t\t\t\t\t\thref=\"" . htmlspecialchars($about[4]) . "\">" . __("more info") . "</a>";
             }
             print "</td>";
             print "<td>" . htmlspecialchars(sprintf("%.2f", $about[0])) . "</td>";
             print "<td>" . htmlspecialchars($about[2]) . "</td>";
             if (count($tmppluginhost->get_all($plugin)) > 0) {
                 if (in_array($name, $system_enabled)) {
                     print "<td><a href='#' onclick=\"clearPluginData('{$name}')\"\n\t\t\t\t\t\t\tclass='visibleLink'>" . __("Clear data") . "</a></td>";
                 }
             }
             print "</tr>";
         }
     }
     print "<tr><td colspan='4'><h3>" . __("User plugins") . "</h3></td></tr>";
     print "<tr class=\"title\">\n\t\t\t\t<td width=\"5%\">&nbsp;</td>\n\t\t\t\t<td width='10%'>" . __('Plugin') . "</td>\n\t\t\t\t<td width=''>" . __('Description') . "</td>\n\t\t\t\t<td width='5%'>" . __('Version') . "</td>\n\t\t\t\t<td width='10%'>" . __('Author') . "</td></tr>";
     foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
         $about = $plugin->about();
开发者ID:bohoo,项目名称:tiny_tiny_rss-openshift-quickstart-2,代码行数:67,代码来源:prefs.php

示例4: while

        $result = db_query("SELECT id, title, content FROM ttrss_entries WHERE tsvector_combined IS NULL ORDER BY id LIMIT {$limit}");
        while ($line = db_fetch_assoc($result)) {
            $tsvector_combined = db_escape_string(mb_substr($line['title'] . ' ' . strip_tags(str_replace('<', ' <', $line['content'])), 0, 1000000));
            db_query("UPDATE ttrss_entries SET tsvector_combined = to_tsvector('english', '{$tsvector_combined}') WHERE id = " . $line["id"]);
        }
        $processed += db_num_rows($result);
        print "Processed {$processed} articles...\n";
        if (db_num_rows($result) != $limit) {
            echo "All done.\n";
            break;
        }
    }
}
if (isset($options["list-plugins"])) {
    $tmppluginhost = new PluginHost();
    $tmppluginhost->load_all($tmppluginhost::KIND_ALL, false);
    $enabled = array_map("trim", explode(",", PLUGINS));
    echo "List of all available plugins:\n";
    foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
        $about = $plugin->about();
        $status = $about[3] ? "system" : "user";
        if (in_array($name, $enabled)) {
            $name .= "*";
        }
        printf("%-50s %-10s v%.2f (by %s)\n%s\n\n", $name, $status, $about[0], $about[2], $about[1]);
    }
    echo "Plugins marked by * are currently enabled for all users.\n";
}
if (isset($options["debug-feed"])) {
    $feed = $options["debug-feed"];
    if (isset($options["force-refetch"])) {
开发者ID:kucrut,项目名称:tt-rss,代码行数:31,代码来源:update.php


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