本文整理汇总了PHP中rw_fs函数的典型用法代码示例。如果您正苦于以下问题:PHP rw_fs函数的具体用法?PHP rw_fs怎么用?PHP rw_fs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rw_fs函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PowerOn
public static function PowerOn()
{
self::$_on = true;
$bt = debug_backtrace();
$caller = array_shift($bt);
self::$_start = strpos($caller['file'], '/plugins/rating-widget/') + strlen('/plugins/rating-widget');
self::$_logger = rw_fs()->get_logger();
self::$_logger->on();
if (WP_RW__LOG_DUMP) {
self::$_logger->echo_on();
}
}
示例2: optional_migration
/**
* Optional data migration based on the database stored options.
*
* @author Vova Feldman (@svovaf)
* @since 2.6.3
*/
private function optional_migration()
{
$site_id = $this->_options->get_option(WP_RW__DB_OPTION_SITE_ID);
if (empty($site_id)) {
$fs_options = rw_fs()->get_options_manager(WP_FS__ACCOUNTS_OPTION_NAME, true, false);
if (false === $fs_options) {
} else {
// Check if RW account stored in FS accounts object (was set in one of the first FS semi-integrated versions.
$sites = $fs_options->get_option('sites');
if (!empty($sites) && is_array($sites) && 0 < count($sites)) {
foreach ($sites as $basename => $site) {
if ('/rating-widget.php' !== substr($basename, -strlen('/rating-widget.php'))) {
continue;
}
if (is_object($site) && !empty($site->secret_key) && 'sk_' !== substr($site->secret_key, 0, 3) && !empty($site->public_key) && 'pk_' !== substr($site->public_key, 0, 3)) {
$this->migrate_from_fs_options($fs_options, $basename);
}
}
}
}
}
}
示例3: __construct
private function __construct()
{
$this->fs = rw_fs();
$this->_options_manager = rw_fs_options();
if (WP_RW__DEBUG) {
$this->InitLogger();
}
// Load plugin options.
$this->LoadDefaultOptions();
$this->LoadOptions();
// Give 2nd chance to logger after options are loaded.
if (!RWLogger::IsOn() && $this->GetOption(WP_RW__LOGGER)) {
$this->InitLogger();
}
// If not in admin dashboard and account don't exist, don't continue with plugin init.
if (!$this->fs->is_registered() && !is_admin()) {
return;
}
// Load config after keys are loaded.
require_once WP_RW__PLUGIN_DIR . "/lib/config.php";
// Load top-rated
require_once WP_RW__PLUGIN_LIB_DIR . "rw-top-rated-widget.php";
}
示例4: isset
</td>
<input type="hidden" class="multi-rating-label" name="multi_rating[criteria][][label]"
value="<?php
echo isset($criterion['label']) ? $criterion['label'] : '';
?>
"/>
</tr>
<?php
}
?>
<tr class="rw-add-rating-container">
<td colspan="3">
<div class="rw-dash">
<?php
$upgrade_label_text = __rw('upgrade_criteria-limit');
if ($total_criteria >= 3 && !rw_fs()->is_plan_or_trial('professional')) {
?>
<a class="rw-add-rating upgrade" href="<?php
echo $rw_fs->get_upgrade_url();
?>
"
data-upgrade-href="<?php
echo $rw_fs->get_upgrade_url();
?>
"
data-upgrade-text="[+] <?php
echo $upgrade_label_text;
?>
"
data-default-text="[+] <?php
echo $add_criteria_str;
示例5:
echo WP_RW__ADMIN_MENU_SLUG;
?>
:hover .wp-menu-image a,
ul#adminmenu li.toplevel_page_<?php
echo WP_RW__ADMIN_MENU_SLUG;
?>
.wp-has-current-submenu .wp-menu-image a,
ul#adminmenu li.toplevel_page_<?php
echo WP_RW__ADMIN_MENU_SLUG;
?>
.current .wp-menu-image a
{ background-position: -1px 0; }
ul#adminmenu li.toplevel_page_<?php
echo WP_RW__ADMIN_MENU_SLUG;
?>
.wp-menu-image a img { display: none; }
<?php
if (rw_fs()->is_not_paying()) {
?>
ul#adminmenu li.toplevel_page_<?php
echo WP_RW__ADMIN_MENU_SLUG;
?>
ul li:last-child a {
color: yellowgreen;
font-weight: bold;
text-transform: uppercase;
}
<?php
}
?>
</style>
示例6: _erw
<table cellpadding="0" cellspacing="0">
<tr>
<td style="width: 50%; vertical-align: top;">
<div style="font-size: 15px;line-height: 21px;">
<?php
_erw('dummy-report-marketing');
?>
</div>
<div id="rw_new_wp_subscribe">
<input type="hidden" id="rw_wp_uid"
value="<?php
echo rw_account()->site_public_key;
?>
"/>
<a href="<?php
echo rw_fs()->get_upgrade_url();
?>
"
onclick="_gaq.push(['_trackEvent', 'upgrade', 'wordpress', 'gopro_button', 1, true]); _gaq.push(['_link', this.href]); return false;"
class="button-primary gradient"
style="display: block; text-align: center;"><?php
_erw('learn-more');
?>
</a>
</div>
</td>
<td>
<ul id="rw_wp_premium_features"
style="float: right; padding-left: 50px; border-left: 1px solid rgb(152, 223, 152);">
<li><b><?php
_erw('upgrade_rich-snippets');
示例7: _e
if ('laccount' === $settings->identify_by) {
echo ' checked="checked"';
}
?>
> <span><?php
_e('Identify visitor by Cookie / Device.', WP_RW__ID);
?>
</span>
</div>
<div class="rw-ui-img-radio rw-ui-hor<?php
if ('ip' === $settings->identify_by) {
echo ' rw-selected';
}
?>
"<?php
if (!rw_fs()->is_plan_or_trial('professional')) {
?>
data-alert="<?php
_e('Visitor by IP identification is only supported in Professional plan and above.', WP_RW__ID);
?>
"<?php
}
?>
>
<input type="radio" name="rw_identify_by" value="ip" <?php
if ('ip' === $settings->identify_by) {
echo ' checked="checked"';
}
?>
> <span><?php
_e('Identify visitor by IP / Location. <b>Especially for Voting Contests</b> (included in Professional Plan).', WP_RW__ID);
示例8: rw_attach_rating_js
//.........这里部分代码省略.........
}
}
$is_bp_activity_component = function_exists('bp_is_activity_component') && bp_is_activity_component();
if (!$attach_js) {
// Necessary for rendering newly inserted activity ratings
// when the are no status updates or comments yet
if ($is_bp_activity_component) {
$bp_rclasses = array('activity-update', 'activity-comment');
foreach ($bp_rclasses as $rclass) {
if (isset($rw_settings[$rclass]) && !isset($rw_settings[$rclass]['enabled'])) {
if (RWLogger::IsOn()) {
RWLogger::Log('rw_attach_rating_js', 'Class = ' . $rclass . ';');
}
$rw_settings[$rclass]['enabled'] = true;
// Get rating class settings.
$rw_settings[$rclass]['options'] = $this->GetOption($rw_settings[$rclass]['options']);
if (WP_RW__AVAILABILITY_DISABLED === $this->rw_validate_availability($rclass)) {
// Disable ratings (set them to be readOnly).
$rw_settings[$rclass]['options']->readOnly = true;
}
$attach_js = true;
}
}
}
}
if ($attach_js || $this->_TOP_RATED_WIDGET_LOADED) {
?>
<!-- This site's ratings are powered by RatingWidget plugin v<?php
echo WP_RW__VERSION;
?>
- https://rating-widget.com/wordpress-plugin/ -->
<div class="rw-js-container">
<?php
if (rw_fs()->_has_addons()) {
rw_wf()->print_site_script();
}
?>
<script type="text/javascript">
// Initialize ratings.
function RW_Async_Init(){
RW.init({<?php
// User key (uid).
echo 'uid: "' . $this->account->site_public_key . '"';
// User id (huid).
if ($this->account->has_site_id()) {
echo ', huid: "' . $this->account->site_id . '"';
}
global $pagenow;
$vid = 0;
// Only set the vid to 1 if the comment ratings mode is set to "Admin ratings only".
if ('comment.php' === $pagenow && $this->is_comment_admin_ratings_mode()) {
$vid = 1;
} else {
// User logged-in.
$user = wp_get_current_user();
$vid = $user->ID;
}
if ($vid !== 0) {
// Set voter id to logged user id.
echo ", vid: {$vid}";
}
?>
,
source: "wordpress",
options: {
示例9: htmlspecialchars
echo $p['title'];
?>
:</nobr>
</td>
<td>
<code><?php
echo htmlspecialchars($p['value']);
?>
</code>
</td>
<?php
if (WP_RW__DEBUG) {
?>
<td class="fs-right">
<form action="<?php
echo rw_fs()->_get_admin_page_url('account');
?>
" method="POST"
onsubmit="var val = prompt('<?php
printf(__rw('what-is-your'), $p['title']);
?>
', '<?php
echo $p['value'];
?>
'); if (null == val || '' === val) return false; jQuery('input[name=rw_<?php
echo $p['id'];
?>
]').val(val); return true;">
<input type="hidden" name="rw_action" value="update_<?php
echo $p['id'];
?>
示例10: strtolower
case 'last_7_days':
$since_created = WP_RW__TIME_WEEK_IN_SEC;
break;
case 'last_24_hours':
$since_created = WP_RW__TIME_24_HOURS_IN_SEC;
break;
default:
$since_created = WP_RW__TIME_ALL_TIME;
break;
}
// Validate the direction attribute
$direction = strtolower($direction);
if ('ltr' !== $direction && 'rtl' !== $direction) {
$direction = 'ltr';
}
if (!rw_fs()->is_plan_or_trial__premium_only('professional')) {
// Ensure that the maximum number of items is 10 for the free version.
$max_items = min($max_items, 10);
}
$rw_ret_obj = ratingwidget()->GetTopRatedData(array($type), $max_items, 0, $min_votes, false, false, $order_by, $order, $since_created);
if ($rw_ret_obj && count($rw_ret_obj->data)) {
// Retrieve the rating types settings
$types = ratingwidget()->get_rating_types();
$container_class = 'rw-top-rated-page ' . $direction;
$html = '<div class="' . $container_class . '">';
foreach ($rw_ret_obj->data as $type => $ratings) {
// Now, retrieve the rclass from the type settings
$rclass = $types[$type]['rclass'];
if (is_array($ratings) && count($ratings) > 0) {
$html .= '<div class="rw-top-rated-page-' . $type . '" class="rw-wp-ui-top-rated-list-container">';
$html .= '<ul class="rw-wp-ui-top-rated-list">';
示例11: init
/**
* Configures the admin menus and registers the hooks and filters needed for the admin area and site.
*
* @author Leo Fajardo (@leorw)
*/
function init()
{
if (is_admin() && rw_fs()->has_installed_addons()) {
$this->_init_admin();
} else {
$this->_init_site();
}
}
示例12: widget
function widget($args, $instance)
{
/**
* @var RatingWidgetPlugin $rwp
*/
global $rwp;
if (RWLogger::IsOn()) {
$params = func_get_args();
RWLogger::LogEnterence("RatingWidgetPlugin_TopRatedWidget.widget", $params, true);
}
if (!rw_account()->is_registered()) {
return;
}
if (RatingWidgetPlugin::$WP_RW__HIDE_RATINGS) {
return;
}
extract($args, EXTR_SKIP);
$bpInstalled = $rwp->IsBuddyPressInstalled();
if (rw_fs()->is__premium_only()) {
$bbInstalled = $rwp->IsBBPressInstalled();
} else {
$bbInstalled = false;
}
$types = $this->GetTypesInfo();
$show_any = false;
foreach ($types as $type => $data) {
if (false !== $instance["show_{$type}"]) {
$show_any = true;
break;
}
}
if (RWLogger::IsOn()) {
RWLogger::Log('RatingWidgetPlugin_TopRatedWidget', 'show_any = ' . ($show_any ? 'TRUE' : 'FALSE'));
}
if (false === $show_any) {
// Nothing to show.
return;
}
$details = array("uid" => rw_account()->site_public_key);
$queries = array();
foreach ($types as $type => $type_data) {
if (isset($instance["show_{$type}"]) && $instance["show_{$type}"] && $instance["{$type}_count"] > 0) {
$options = ratingwidget()->GetOption($type_data["options"]);
$queries[$type] = array("rclasses" => $type_data["classes"], "votes" => max(1, (int) $instance["{$type}_min_votes"]), "orderby" => $instance["{$type}_orderby"], "order" => $instance["{$type}_order"], "limit" => (int) $instance["{$type}_count"], "types" => isset($options->type) ? $options->type : "star");
$since_created = isset($instance["{$type}_since_created"]) ? (int) $instance["{$type}_since_created"] : WP_RW__TIME_ALL_TIME;
// since_created should be at least 24 hours (86400 seconds), skip otherwise.
if ($since_created >= WP_RW__TIME_24_HOURS_IN_SEC) {
$time = current_time('timestamp', true) - $since_created;
// c: ISO 8601 full date/time, e.g.: 2004-02-12T15:19:21+00:00
$queries[$type]['since_created'] = date('c', $time);
}
}
}
$details["queries"] = urlencode(json_encode($queries));
$rw_ret_obj = ratingwidget()->RemoteCall("action/query/ratings.php", $details, WP_RW__CACHE_TIMEOUT_TOP_RATED);
if (false === $rw_ret_obj) {
return;
}
$rw_ret_obj = json_decode($rw_ret_obj);
if (null === $rw_ret_obj || true !== $rw_ret_obj->success) {
return;
}
// Check if data is available
if (!isset($rw_ret_obj->data)) {
return;
}
$title = empty($instance['title']) ? __rw('top-rated') : apply_filters('widget_title', $instance['title']);
$titleMaxLength = isset($instance['title_max_length']) && is_numeric($instance['title_max_length']) ? (int) $instance['title_max_length'] : 30;
$empty = true;
$toprated_data = new stdClass();
$toprated_data->id = rand(1, 100);
$toprated_data->title = array('label' => $title, 'show' => true, 'before' => $this->EncodeHtml($before_title), 'after' => $this->EncodeHtml($after_title));
$toprated_data->options = array('align' => 'vertical', 'direction' => 'ltr', 'html' => array('before' => $this->EncodeHtml($before_widget), 'after' => $this->EncodeHtml($after_widget)));
$toprated_data->site = array('id' => rw_account()->site_id, 'domain' => $_SERVER['HTTP_HOST'], 'type' => 'WordPress');
$toprated_data->itemGroups = array();
if (count($rw_ret_obj->data) > 0) {
foreach ($rw_ret_obj->data as $type => $ratings) {
if (is_array($ratings) && count($ratings) > 0) {
$item_group = new stdClass();
$item_group->type = $type;
$item_group->title = $instance["{$type}_title"];
$item_group->showTitle = 1 === $instance["show_{$type}_title"] && '' !== trim($item_group->title);
if (is_numeric($instance["{$type}_style"])) {
switch ($instance["{$type}_style"]) {
case 0:
$instance["{$type}_style"] = 'legacy';
break;
case 1:
default:
$instance["{$type}_style"] = 'thumbs';
break;
}
}
$item_group->style = $instance["{$type}_style"];
$item_group->options = array('title' => array('maxLen' => $titleMaxLength));
$item_group->items = array();
$has_thumb = strtolower($instance["{$type}_style"]) !== 'legacy';
$thumb_width = 160;
$thumb_height = 100;
if ($has_thumb) {
//.........这里部分代码省略.........
示例13: rw_include_once_view
?>
">
<?php
rw_include_once_view("settings/theme.php");
?>
</tr>
<tr id="rw_star_size" class="rw-<?php
echo ($odd = !$odd) ? "odd" : "even";
?>
">
<?php
rw_include_once_view("settings/size.php");
?>
</tr>
<?php
if (rw_fs()->is__premium_only()) {
?>
<?php
if (ratingwidget()->IsBuddyPressInstalled() || ratingwidget()->IsBBPressInstalled()) {
?>
<tr id="rw_rate_background" class="rw-<?php
echo ($odd = !$odd) ? "odd" : "even";
?>
">
<?php
rw_include_once_view("settings/background.php");
?>
</tr>
<?php
}
?>
示例14: __construct
private function __construct($load = false)
{
$this->optional_migration();
$this->_options = rw_fs()->get_options_manager(WP_RW__OPTIONS, true, false);
}