Beispiel #1
0
        global $wpdb;
        // Fix Button widget to new sizes options
        $post_ids = $wpdb->get_col($wpdb->prepare('SELECT `post_id` FROM %1$s
						WHERE `meta_key` = \'_elementor_version\'
							AND `meta_value` = \'%2$s\';', $wpdb->postmeta, '0.3'));
        if (empty($post_ids)) {
            return;
        }
        foreach ($post_ids as $post_id) {
            $data = Plugin::instance()->db->get_plain_editor($post_id);
            $data = Plugin::instance()->db->iterate_data($data, function ($element) {
                if (empty($element['widgetType'])) {
                    return $element;
                }
                if ('button' === $element['widgetType']) {
                    $size_to_replace = ['small' => 'xs', 'medium' => 'sm', 'large' => 'md', 'xl' => 'lg', 'xxl' => 'xl'];
                    if (!empty($element['settings']['size'])) {
                        $old_size = $element['settings']['size'];
                        if (isset($size_to_replace[$old_size])) {
                            $element['settings']['size'] = $size_to_replace[$old_size];
                        }
                    }
                }
                return $element;
            });
            Plugin::instance()->db->save_editor($post_id, $data);
        }
    }
}
Upgrades::add_actions();
Beispiel #2
0
	$msg = Upgrades::upgradeRA($user);
}
else if ($filtered['upgrade-up']) {
	$msg = Upgrades::upgradeUP($user);
}
else if ($filtered['upgrade-of']) {
	$msg = Upgrades::upgradeOf($user);
}
else if ($filtered['upgrade-bk']) {
	$msg = Upgrades::upgradeBk($user);
}
else if ($filtered['upgrade-hh']) {
	$msg = Upgrades::upgradeHH($user);
}
else if ($filtered['upgrade-up-max']) {
	$msg = Upgrades::upgradeUPMax($user);
}

if ($msg) {
	if (Upgrades::$isErr) {
		$t->err = $msg;
	}
	else {
		$t->msg = $msg;
	}
}

$t->user = $user;
$t->pageTitle = 'Upgrades';
$t->display();
Beispiel #3
0
	public static function
	upgradeUPMax(User $user) {
		$Li = $user->up;
		$goldi = $user->getPrimary();
		$gold = $goldi;
		$cost = 0;
		$Lf = sqrt(0.25 + $Li * (1 + $Li) + $gold * 0.0002) - 0.5;
		$up = floor($Lf);
		$gold = 10000 * ($Lf - $up) + 5000 * ($Lf * ($Lf - 1) - $up * ($up - 1));

		$delta = $up - $Li;
		$cost = $goldi - $gold;
		$what = 'up';
		$name = 'Unit Production';

		return Upgrades::upgrade($user, $name, $cost, $what, $delta);
	}
Beispiel #4
0
				</tr>
				<? if ($user->getSupport('upgrades')) { ?>
					<tr>
						<td>Upgrade Officer Limit</td>
						<td><?php 
echo $user->maxofficers;
?>
</td>
						<td><input type="submit" name="upgrade-of" value="<?php 
echo numecho(Upgrades::ofCost($user));
?>
 Gold" /></td>
					</tr>
					<tr>
						<td>Upgrade Bank Deposit Percentage</td>
						<td><?php 
echo $user->bankper;
?>
%</td>
						<td><input type="submit" name="upgrade-bk" value="<?php 
echo numecho(Upgrades::bkCost($user));
?>
 Gold" /></td>
					</tr>
				<? } ?>
			</table>
		</form>
	</div>
</div>
<!-- End upgrades page -->