Example #1
0
/**
 * return the download URL of a theme
 *
 * @param int $id ID of the theme
 *
 * @return string URL of the theme
 */
function ThemesApi_downloadLink($id)
{
    return ThemesApi_calculateUrl() . '/ww.plugins/themes-api/api.php?download=true&id=' . $id;
}
Example #2
0
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post_array);
    $response = curl_exec($curl);
    /**
     * check if HTML is valid
     */
    if (strpos($response, 'success') === false) {
        $response = preg_replace('#(<form.*?>).*?(</form>)#', '', $response);
        ThemesApi_error($response, $id);
    }
}
/**
 * copy screenshot file to themes dir
 * for use later
 */
shell_exec('cd ' . $theme_dir . $id . ' && unzip -o ' . $id . '.zip && mv ' . $f_name . ' ' . $id);
shell_exec('convert "' . $theme_dir . $id . '/' . $id . '/screenshot.png" -resize 240x172 "' . $theme_dir . $id . '/' . $id . '/screenshot.png');
/**
 * figure out who is in the moderation team
 * and send them all an email
 */
$id = dbOne('select id from groups where name="moderators"', 'id');
$users = dbAll('select name, email from user_accounts, users_groups where groups_id=' . $id . ' and user_accounts_id=id');
$url = ThemesApi_calculateUrl();
$users_c = count($users);
if ($users_c != 0 && $users != false) {
    for ($i = 0; $i < $users_c; ++$i) {
        $body = '<h3>' . __('Theme Moderation') . '</h3>' . '<p>' . __('Hi %1,', array($users[$i]['name']), 'core') . '</p>' . '<p>' . __('A new theme named "%1" has been marked for moderation, please' . ' <a href="%2/ww.admin">log in</a> and moderate the theme.', array($name, $url), 'core') . '</p>' . '<p>' . __('Thanks<br/>---<br/>kvWebME') . '</p>';
        send_mail($users[$i]['email'], 'noreply@' . $_SERVER['HTTP_HOST'], __('Theme Moderation'), $body, false);
    }
}
ThemesApi_error('ok');