/** * Update a specific email campaign * @param string $accessToken - Constant Contact OAuth2 access token * @param Campaign $campaign - Campaign to be updated * @return Campaign */ public function updateCampaign($accessToken, Campaign $campaign) { $baseUrl = Configs::get('endpoints.base_url') . sprintf(Configs::get('endpoints.campaign'), $campaign->id); $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->put($url, parent::getHeaders($accessToken), $campaign->toJson()); return Campaign::create(json_decode($response->body, true)); }
public static function get_by_key($key) { $config = Configs::get(NULL, NULL, "security_key", $key); if (!is_array($config)) { return $config->get_location(); } else { return false; } }
public function __construct() { $this->_dbhost = Configs::get('mysql/host'); $this->_dbuser = Configs::get('mysql/user'); $this->_dbpasswd = Configs::get('mysql/password'); $this->_dbname = Configs::get('mysql/dbname'); @($this->con = @mysqli_connect($this->_dbhost, $this->_dbuser, $this->_dbpasswd, $this->_dbname)); if (!$this->con) { @die('Database connect error! please, see again informaiton about database config of you!' . mysqli_error($this->con)); } }
<?php Output::set_title("System Configuration"); MainTemplate::set_subtitle("View and edit system configuration settings"); echo "\n\t<table class=\"table table-striped table-hover\">\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th class=\"title\">Setting</th>\n\t\t\t\t<th class=\"icon\">Value</th>\n\t\t\t\t<th class=\"icon\"></th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody>"; $settings = Configs::get(NULL, -1); foreach ($settings as $setting) { echo "<tr>\n\t\t\t\t<td>\n\t\t\t\t\t" . $setting->get_parameter() . "\n\t\t\t\t</td>\n\t\t\t\t<td>\n\t\t\t\t\t<strong>" . $setting->get_val() . "</strong> <br />\n\t\t\t\t</td>\n\t\t\t\t<td class=\"icon\">\n\t\t\t\t\t\n\t\t\t\t\t <!-- Button trigger modal -->\n\t\t\t\t\t <a data-toggle=\"modal\" href=\"#" . $setting->get_parameter() . "\"><span class='glyphicon glyphicon-edit'></span></a>\n\n\t\t\t\t\t <!-- Modal -->\n\t\t\t\t\t <div class=\"modal fade\" id=\"" . $setting->get_parameter() . "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">\n\t\t\t\t\t <div class=\"modal-dialog\">\n\t\t\t\t\t <div class=\"modal-content\">\n\t\t\t\t\t <div class=\"modal-header\">\n\t\t\t\t\t <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n\t\t\t\t\t <h4 class=\"modal-title\">Change Value for " . $setting->get_parameter() . "</h4>\n\t\t\t\t\t </div>\n\t\t\t\t\t <div class=\"modal-body\">\n\t\t\t\t\t <form role=\"form\">\n\t\t\t\t\t\t\t\t <div class=\"form-group\">\n\t\t\t\t\t\t\t\t <label for=\"settingUpdateText\">Value for " . $setting->get_parameter() . "</label>\n\t\t\t\t\t\t\t\t <input type=\"text\" class=\"form-control\" id=\"settingUpdateText\" placeholder=\"Enter new value\" value=\"" . $setting->get_val() . "\">\n\t\t\t\t\t\t\t\t </div>\n\t\t\t\t\t </div>\n\t\t\t\t\t <div class=\"modal-footer\">\n\t\t\t\t\t <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>\n\t\t\t\t\t <button type=\"button\" class=\"btn btn-primary\">Save changes</button>\n\t\t\t\t\t </div>\n\t\t\t\t\t </form>\n\t\t\t\t\t </div><!-- /.modal-content -->\n\t\t\t\t\t </div><!-- /.modal-dialog -->\n\t\t\t\t\t </div><!-- /.modal -->\n\t\t\t\t</td>\n\t\t\t</tr>"; } echo "\t\t</tbody>\n\t</table>";
/** * Get all contacts from an individual list * @param string $accessToken - Constant Contact OAuth2 access token * @param string $list_id - list id to retrieve contacts for * @param array $params - query params to attach to request * @return ResultSet */ public function getContactsFromList($accessToken, $list_id, $params = null) { $baseUrl = Configs::get('endpoints.base_url') . sprintf(Configs::get('endpoints.list_contacts'), $list_id); $url = $this->buildUrl($baseUrl, $params); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); $body = json_decode($response->body, true); $contacts = array(); foreach ($body['results'] as $contact) { $contacts[] = Contact::create($contact); } //return new ResultSet($contacts, $body['meta']); return $contacts; }
<?php Output::set_template(); if (isset($_REQUEST["key"])) { $location = Locations::get_by_key($_REQUEST["key"]); $key = $_REQUEST["key"]; } else { if (isset($_REQUEST["location"])) { $location = Locations::get_by_id($_REQUEST["location"]); $key = $location->get_key(); } else { exit("No location specified!"); } } switch ($_REQUEST["action"]) { case "check-next": $next = Configs::get(NULL, $location, "next_on_showplan")->get_val(); if ($next == "") { echo json_encode(array("response" => "false")); } else { echo json_encode(array("response" => "true", "md5" => $next)); } break; case "load-player": $config = Configs::get(NULL, $location, "next_on_showplan"); $audio = Audio::get_by_md5($config->get_val()); $config->set_val(""); echo json_encode(array("response" => "success", "title" => $audio->get_title(), "artist" => $audio->get_artists_str())); break; }
public function get_config($param) { return Configs::get(NULL, $this, $param); }
/** * Get the id of object, or attempt to convert the argument to an int * @param mixed $item - object or a numeric value * @param string $className - class name to test the given object against * @throws IllegalArgumentException - if the item is not an instance of the class name given, or cannot be * converted to a numeric value * @return int */ private function getArgumentId($item, $className) { $id = null; if (is_numeric($item)) { $id = $item; } elseif (join('', array_slice(explode('\\', get_class($item)), -1)) == $className) { $id = $item->id; } else { throw new IllegalArgumentException(sprintf(Configs::get('errors.id_or_object'), $className)); } return $id; }