/** * try to turn a mixture of html code an plain text into valid html * * @param string $html input * @return string encoded output */ function html_encode_str_smart($html) { // TODO (later): remove debug code log_msg('debug', 'html_encode_str_smart: string is ' . quot(var_dump_inl($html))); // encode ampersand characters where needed $cur = 0; while ($cur < strlen($html)) { // check & if (substr($html, $cur, 1) == '&') { $replace = true; // DEBUG $reason = false; // check &#?? if ($cur + 3 < strlen($html) && substr($html, $cur + 1, 1) == '#') { // check $#x or not if (strtolower(substr($html, $cur + 2, 1)) == 'x') { // check for hexadecimal characters before ; $ahead = $cur + 3; while ($ahead < strlen($html)) { $char = strtolower(substr($html, $ahead, 1)); if (48 <= ord($char) && ord($char) <= 57 || 97 <= ord($char) && ord($char) <= 102) { // valid hexadecimal character $ahead++; } elseif ($char == ';') { if ($cur + 3 < $ahead) { // valid entitiy $replace = false; break; } else { // invalid entity // DEBUG $reason = 1; break; } } else { // invalid entity // DEBUG $reason = 2; break; } } if ($ahead == strlen($html)) { // DEBUG $reason = 3; } } elseif (is_numeric(substr($html, $cur + 2, 1))) { // check for for decimal characters before ; $ahead = $cur + 3; while ($ahead < strlen($html)) { $char = substr($html, $ahead, 1); if (48 <= ord($char) && ord($char) <= 57) { // valid decimal character $ahead++; } elseif ($char == ';') { // valid entity $replace = false; break; } else { // invalid entity $reason = 4; break; } } if ($ahead == strlen($html)) { // DEBUG $reason = 5; } } else { // DEBUG $reason = 6; } } else { // assume a named entity // it turns out we can't use get_html_translation_table() // for this as the HTML_ENTITIES table is not complete $ahead = $cur + 1; while ($ahead < strlen($html)) { $char = strtolower(substr($html, $ahead, 1)); if (48 <= ord($char) && ord($char) <= 57 || 97 <= ord($char) && ord($char) <= 122) { // valid alphanumeric character $ahead++; } elseif ($char == ';') { if ($cur + 1 < $ahead) { // (supposedly) valid entity $replace = false; break; } else { // invalid entity // DEBUG $reason = 7; break; } } else { // invalid entity // DEBUG $reason = 8; break; } } if ($ahead == strlen($html)) { $reason = 9; break; } } if ($replace) { log_msg('debug', 'html_encode_str_smart: replacing ampersand at ' . $cur . ' because of ' . $reason); $html = substr($html, 0, $cur) . '&' . substr($html, $cur + 1); log_msg('debug', 'html_encode_str_smart: new string is ' . quot(var_dump_inl($html))); $cur += 5; } else { log_msg('debug', 'html_encode_str_smart: not replacing ampersand at ' . $cur); $cur++; } } else { $cur++; } } // encode < and > where needed $cur = 0; while ($cur < strlen($html)) { $char = substr($html, $cur, 1); $replace = true; if ($char == '<') { // a possible tag // search for a closing bracket $ahead = $cur + 1; while ($ahead < strlen($html)) { $c = strtolower(substr($html, $ahead, 1)); if ($c == '<') { // found another opening bracket // the first one can't be legit // DEBUG $reason = 1; break; } elseif ($c == '>') { if ($cur + 1 < $ahead) { // can be a valid tag $replace = false; // forward till after the closing bracket $cur = $ahead; break; } else { // invalid (empty) tag // DEBUG $reason = 2; break; } } elseif ($ahead == $cur + 1) { if (48 <= ord($c) && ord($c) <= 57 || 97 <= ord($c) && ord($c) <= 122 || $c == '/') { // starts with an alphanumeric character or a slash, can be valid } else { // DEBUG $reason = 3; break; } } $ahead++; } if ($ahead == strlen($html)) { // DEBUG $reason = 4; } } else { if ($char == '>') { // we should be getting all valid tags through the code above // DEBUG $reason = 5; } } if ($replace && $char == '<') { log_msg('debug', 'html_encode_str_smart: replacing opening bracket at ' . $cur . ' because of ' . $reason); $html = substr($html, 0, $cur) . '<' . substr($html, $cur + 1); log_msg('debug', 'html_encode_str_smart: new string is ' . quot(var_dump_inl($html))); $cur += 4; } elseif ($replace && $char == '>') { log_msg('debug', 'html_encode_str_smart: replacing closing bracket at ' . $cur . ' because of ' . $reason); $html = substr($html, 0, $cur) . '>' . substr($html, $cur + 1); log_msg('debug', 'html_encode_str_smart: new string is ' . quot(var_dump_inl($html))); $cur += 4; } else { $cur++; } } return $html; }
/** * disable caching of output * * can be used for modules that need the php to be executed every time. * @param string $reason (e.g. your module) */ function html_disable_caching($reason = '') { global $html; if ($html['cache']) { log_msg('info', 'html: disabled caching for this request because of ' . quot($reason)); $html['cache'] = false; } }
<?php /* * index.php * Main HTTP request handler * * Copyright Gottfried Haider, Danja Vasiliev 2010. * This source code is licensed under the GNU General Public License. * See the file COPYING for more details. */ @(require_once 'config.inc.php'); require_once 'log.inc.php'; log_msg('info', '--- request ---'); require_once 'controller.inc.php'; require_once 'modules.inc.php'; $args = parse_query_string(); log_msg('info', 'index: query arguments ' . var_dump_inl($args)); log_msg('debug', 'index: base url is ' . quot(base_url())); invoke_controller($args);
function page_upload($args) { // only handle the file if the frontend wants us to if (empty($args['preferred_module']) || $args['preferred_module'] != 'page') { return false; } // check if supported file if (!in_array($args['mime'], array('image/jpeg', 'image/png', 'image/gif')) || $args['mime'] == '' && !in_array(filext($args['file']), array('jpg', 'jpeg', 'png', 'gif'))) { return false; } // check if there is already a background-image and delete it $obj = load_object(array('name' => $args['page'] . '.page')); if (!$obj['#error']) { $obj = $obj['#data']; if (!empty($obj['page-background-file'])) { delete_upload(array('pagename' => array_shift(expl('.', $args['page'])), 'file' => $obj['page-background-file'], 'max_cnt' => 1)); } } // set as background-image in page object $obj = array(); $obj['name'] = $args['page'] . '.page'; $obj['page-background-file'] = $args['file']; $obj['page-background-mime'] = $args['mime']; // update page object load_modules('glue'); $ret = update_object($obj); if ($ret['#error']) { log_msg('page_upload: error updating page object: ' . quot($ret['#data'])); return false; } else { // we don't actually render the object here, but signal the // frontend that everything went okay return true; } }
log_msg('warn', 'json: ' . $err['#data']); die; } // check authentication if (isset($m['auth']) && $m['auth']) { if (!is_auth()) { prompt_auth(true); } } if (isset($m['cross-origin']) && $m['cross-origin']) { // output cross-origin header if requested header('Access-Controll-Allow-Origin: *'); } else { // otherwise check the referer to make xsrf harder if (!empty($_SERVER['HTTP_REFERER'])) { $bu = base_url(); if (substr($_SERVER['HTTP_REFERER'], 0, strlen($bu)) != $bu) { echo json_encode(response('Cross-origin requests not supported for this method', 400)); log_msg('warn', 'json: possible xsrf detected, referer is ' . quot($_SERVER['HTTP_REFERER']) . ', arguments ' . var_dump_inl($args)); die; } } } // run service and output result $ret = run_service($method, $args); if (is_array($ret) && isset($ret['#error']) && $ret['#error']) { log_msg('warn', 'json: service ' . $method . ' returned error ' . quot($ret['#data'])); } elseif (is_array($ret) && isset($ret['#data'])) { log_msg('debug', 'json: service returned ' . var_dump_inl($ret['#data'])); } echo json_encode($ret);
/** * serve a resource associated with an object * * the function might not return (e.g. when a module calls serve_file()). * @param string $s object (e.g. page.rev.obj) * @param bool $dl download file * @return bool */ function serve_resource($s, $dl) { load_modules('glue'); // resolve symlinks $ret = object_get_symlink(array('name' => $s)); if ($ret['#error'] == false && $ret['#data'] !== false) { log_msg('debug', 'controller: resolved resource ' . quot($s) . ' into ' . quot($ret['#data'])); $s = $ret['#data']; } $obj = load_object(array('name' => $s)); if ($obj['#error']) { return false; } else { $obj = $obj['#data']; } $ret = invoke_hook_while('serve_resource', false, array('obj' => $obj, 'dl' => $dl)); // this is probably not needed as the module will most likely call // serve_file() on success, which does not return foreach ($ret as $key => $val) { if ($val !== false) { return true; } } return false; }
/** * implements snapshot_symlink * * see snapshot() in module_glue.inc.php */ function image_snapshot_symlink($args) { $obj = $args['obj']; if (!isset($obj['type']) || $obj['type'] != 'image') { return false; } // consider the following: // * an image object is on page a, which at some point got distributed to all // other pages through symlinks // * we are now creating a snapshot of any page b, come across the symlink // pointing to an object and page a // in this case we don't copy the symlink but the current content of the // object, as we by all means want to preserve the current _state_ we copy // the symlink's content (this happens in snapshot() in module_glue.inc.php) // - thus turning it into a first-class object on the new snapshot-page // because of this we need to copy any referenced files as well from the // shared directory in page a to the one on page b, this happens in this // hook $dest_dir = CONTENT_DIR . '/' . array_shift(expl('.', $obj['name'])) . '/shared'; $src_dir = CONTENT_DIR . '/' . array_shift(expl('.', $args['origin'])) . '/shared'; // we do this for image-file and image-resized-file // .. to add a bit of complexity ;) foreach (array('image-file', 'image-resized-file') as $field) { if (empty($obj[$field])) { continue; } else { $src_file = $src_dir . '/' . $obj[$field]; } if (($f = dir_has_same_file($dest_dir, $src_file)) !== false) { $obj[$field] = $f; } else { // copy file $dest_file = $dest_dir . '/' . unique_filename($dest_dir, $src_file); $m = umask(0111); if (!@copy($src_file, $dest_file)) { umask($m); log_msg('error', 'image_snapshot_symlink: error copying referenced file ' . quot($src_file) . ' to ' . quot($dest_file)); return false; } umask($m); $obj[$field] = basename($dest_file); log_msg('info', 'image_snapshot_symlink: copied referenced file to ' . quot($dest_file)); } } // save changes in the object $ret = save_object($obj); if ($ret['#error']) { log_msg('error', 'image_snapshot_symlink: error saving object ' . quot($obj['name'])); return false; } else { return true; } }
*/ class latest_twitter_widget extends WP_Widget { function latest_twitter_widget() { // widget actual processes parent::WP_Widget('latest_twitter_widget', 'Latest twitter widget', array('description' => __('Displays your latest twitter.com updates', 'oblivion'))); } function form($instance) { // outputs the options form on admin if (!function_exists('quot')) { function quot($txt) { return str_replace("\"", """, $txt); } } // format some of the options as valid html @($username = htmlspecialchars($instance['user'], ENT_QUOTES)); @($updateCount = htmlspecialchars($instance['count'], ENT_QUOTES)); @($showTwitterIconTF = $instance['showTwitterIconTF']); @($showProfilePicTF = $instance['showProfilePicTF']); @($showTweetTimeTF = $instance['showTweetTimeTF']); @($widgetTitle = stripslashes(quot($instance['widgetTitle']))); @($includeRepliesTF = $instance['includeRepliesTF']); ?> <p> <label for="<?php echo $this->get_field_id('user'); ?> " style="line-height:35px;display:block;"><?php _e("Twitter user: @", 'oblivion'); ?> <input type="text" size="12" id="<?php echo $this->get_field_id('user'); ?> " name="<?php echo $this->get_field_name('user'); ?> " value="<?php echo $username; ?> " /></label> <label for="<?php echo $this->get_field_id('count'); ?> " style="line-height:35px;display:block;"><?php _e("Show", 'oblivion'); ?> <input type="text" id="<?php echo $this->get_field_id('count'); ?> " size="2" name="<?php echo $this->get_field_name('count'); ?> " value="<?php echo $updateCount; ?> " /><?php _e("twitter updates", 'oblivion'); ?> </label> <label for="<?php echo $this->get_field_id('widgetTitle'); ?> " style="line-height:35px;display:block;"><?php _e("Widget title:", 'oblivion'); ?> <input type="text" id="<?php echo $this->get_field_id('widgetTitle'); ?> " size="16" name="<?php echo $this->get_field_name('widgetTitle'); ?> " value="<?php echo $widgetTitle; ?> " /></label> <p> </p> <p><input type="checkbox" id="<?php echo $this->get_field_id('includeRepliesTF'); ?> " value="1" name="<?php echo $this->get_field_name('includeRepliesTF'); ?> "<?php if ($includeRepliesTF) { ?> checked="checked"<?php } ?> > <label for="<?php echo $this->get_field_id('includeRepliesTF'); ?> "><?php _e("Include replies", 'oblivion'); ?> </label></p>
', ErrorLoadCalendar: '<?php echo quot(ErrorLoadCalendar); ?> ', ErrorLoadEvents: '<?php echo quot(ErrorLoadEvents); ?> ', ErrorUpdateEvent: '<?php echo quot(ErrorUpdateEvent); ?> ', ErrorDeleteEvent: '<?php echo quot(ErrorDeleteEvent); ?> ', ErrorUpdateCalendar: '<?php echo quot(ErrorUpdateCalendar); ?> ', ErrorDeleteCalendar: '<?php echo quot(ErrorDeleteCalendar); ?> ', ErrorGeneral: '<?php echo quot(ErrorGeneral); ?> ' }
function form($instance) { // outputs the options form on admin if (!function_exists('quot')) { function quot($txt) { return str_replace("\"", """, $txt); } } // format some of the options as valid html $username = htmlspecialchars($instance['user'], ENT_QUOTES); $updateCount = htmlspecialchars($instance['count'], ENT_QUOTES); $showTwitterIconTF = $instance['showTwitterIconTF']; $showProfilePicTF = $instance['showProfilePicTF']; $showTweetTimeTF = $instance['showTweetTimeTF']; $widgetTitle = stripslashes(quot($instance['widgetTitle'])); $includeRepliesTF = $instance['includeRepliesTF']; ?> <p> <label for="<?php echo $this->get_field_id('user'); ?> " style="line-height:35px;display:block;">Twitter user: @<input type="text" size="12" id="<?php echo $this->get_field_id('user'); ?> " name="<?php echo $this->get_field_name('user'); ?> " value="<?php echo $username; ?> " /></label> <label for="<?php echo $this->get_field_id('count'); ?> " style="line-height:35px;display:block;">Show <input type="text" id="<?php echo $this->get_field_id('count'); ?> " size="2" name="<?php echo $this->get_field_name('count'); ?> " value="<?php echo $updateCount; ?> " /> twitter updates</label> <label for="<?php echo $this->get_field_id('widgetTitle'); ?> " style="line-height:35px;display:block;">Widget title: <input type="text" id="<?php echo $this->get_field_id('widgetTitle'); ?> " size="16" name="<?php echo $this->get_field_name('widgetTitle'); ?> " value="<?php echo $widgetTitle; ?> " /></label> <p> </p> <p><input type="radio" id="<?php echo $this->get_field_id('showTwitterIconTF'); ?> " value="icon" name="<?php echo $this->get_field_name('showIconOrPic'); ?> "<?php if ($showTwitterIconTF) { ?> checked="checked"<?php } ?> ><label for="<?php echo $this->get_field_id('showTwitterIconTF'); ?> "> Show twitter icon</label></p> <p><input type="radio" id="<?php echo $this->get_field_id('showProfilePicTF'); ?> " value="pic" name="<?php echo $this->get_field_name('showIconOrPic'); ?> "<?php if ($showProfilePicTF) { ?> checked="checked"<?php } ?> ><label for="<?php echo $this->get_field_id('showProfilePicTF'); ?> "> Show profile picture</label></p> <p><input type="radio" id="latest-twitter-showNeitherImageTF" value="none" name="<?php echo $this->get_field_name('showIconOrPic'); ?> "<?php if (!$showProfilePicTF && !$showTwitterIconTF) { ?> checked="checked"<?php } ?> ><label for="latest-twitter-showNeitherImageTF"> Show no image</label></p> <p> </p> <p><input type="checkbox" id="<?php echo $this->get_field_id('showTweetTimeTF'); ?> " value="1" name="<?php echo $this->get_field_name('showTweetTimeTF'); ?> "<?php if ($showTweetTimeTF) { ?> checked="checked"<?php } ?> > <label for="<?php echo $this->get_field_id('showTweetTimeTF'); ?> ">Show tweeted "time ago"</label></p> <p><input type="checkbox" id="<?php echo $this->get_field_id('includeRepliesTF'); ?> " value="1" name="<?php echo $this->get_field_name('includeRepliesTF'); ?> "<?php if ($includeRepliesTF) { ?> checked="checked"<?php } ?> > <label for="<?php echo $this->get_field_id('includeRepliesTF'); ?> ">Include replies</label></p> <p> </p> <p>To style the output of the widget, modify <a href="<?php echo get_bloginfo('url'); ?> /wp-content/plugins/latest-twitter-sidebar-widget/latest_twitter_widget.css">this CSS stylesheet</a>. You should also back this file up before updating the plugin.</p> </p> <?php }
/** * list all objects referencing a certain file in the shared directory * * @param array $args arguments * key 'pagename' is the pagename (i.e. page) * key 'file' filename of file in the shared directory * key 'stop_after' n references * @return array response * array of objects (i.e. page.rev.obj) */ function upload_references($args) { $revs = revisions($args); if ($revs['#error']) { return $revs; } else { $revs = $revs['#data']; } if (empty($args['file'])) { return response('Required argument "file" missing or empty', 400); } // this is an optimization for delete_upload() if (@is_numeric($args['stop_after'])) { $stop_after = intval($args['stop_after']); } else { $stop_after = 0; } $ret = array(); // for each revision foreach ($revs as $rev) { // load all objects $files = @scandir(CONTENT_DIR . '/' . $args['pagename'] . '/' . $rev); foreach ($files as $f) { if ($f == '.' || $f == '..') { continue; } $obj = load_object(array('name' => $args['pagename'] . '.' . $rev . '.' . $f)); if ($obj['#error']) { continue; } else { $obj = $obj['#data']; } // and handle the object to our modules log_msg('debug', 'upload_references: checking ' . quot($obj['name'])); $revs = invoke_hook_while('has_reference', false, array('file' => $args['file'], 'obj' => $obj)); if (count($revs)) { $ret[] = $args['pagename'] . '.' . $rev . '.' . $f; if (count($ret) == $stop_after) { // return prematurely return response($ret); } } } } return response($ret); }
/** * move an uploaded file to the shared directory of a page * * this function reuses existing files when possible. * @param string $fn filename of newly uploaded file (most likely in /tmp) * @param string $page page or pagename * @param string $orig_fn the original filename on the client machine (optional) * @param bool &$existed set to true if the filename returned did already exist * before * @return filename inside the shared directory or false in case of error */ function upload_file($fn, $page, $orig_fn = '', &$existed = false) { // default to the temporary filename if ($orig_fn == '') { $orig_fn = $fn; } $a = expl('.', $page); if (count($a) < 1 || !is_dir(CONTENT_DIR . '/' . $a[0])) { log_msg('error', 'common: page ' . quot($page) . ' does not exist, cannot move uploaded file'); // not sure if we ought to remove the file in /tmp here (probably not) return false; } // create shared directory if it doesn't exist yet $d = CONTENT_DIR . '/' . $a[0] . '/shared'; if (!is_dir($d)) { $m = umask(00); if (!@mkdir($d, 0777)) { umask($m); log_msg('error', 'common: cannot create shared directory ' . quot($d) . ', cannot move uploaded file'); // not sure if we ought to remove the file in /tmp here (probably not) return false; } umask($m); } // check if file is already in shared directory if (($f = dir_has_same_file($d, $fn, $orig_fn)) !== false) { log_msg('info', 'common: reusing file ' . quot($f) . ' instead of newly uploaded file as they don\'t differ'); @unlink($fn); $existed = true; return $f; } else { // at least give it a unique name $f = unique_filename($d, basename($orig_fn)); $m = umask(0111); if (!@move_uploaded_file($fn, $d . '/' . $f)) { umask($m); log_msg('error', 'common: error moving uploaded file to ' . quot($d . '/' . $f)); // not sure if we ought to remove the file in /tmp here (probably not) return false; } else { umask($m); log_msg('info', 'common: moved uploaded file to ' . quot($d . '/' . $f)); $existed = false; return $f; } } }
/** * run a service * * this function checks the arguments in $args against the (optional) * declaration given in register_service(). * @param string $service service name * @param array $args arguments-array * @return return value of the service function or a response-array * in case of an error */ function run_service($service, $args = array()) { global $services; if (!isset($services[$service])) { return response('Unknown service ' . quot($service), 400); } // check arguments foreach ($services[$service]['args'] as $key => $val) { if (!isset($args[$key])) { if (isset($val['req']) && $val['req']) { return response('Required argument ' . quot($key) . ' missing', 400); } elseif (isset($val['def'])) { $args[$key] = $val['def']; } } if (isset($val['type'])) { if ($val['type'] == 'array') { if (is_array($args[$key])) { // nothing to do here } elseif (is_object($args[$key])) { // convert to array $args[$key] = (array) $args[$key]; } else { return response('Invalid type of argument ' . quot($key) . ', expected array', 400); } } elseif ($val['type'] == 'bool') { if (is_bool($args[$key])) { // nothing to do here } elseif (intval($args[$key]) === 1) { $args[$key] = true; } elseif (intval($args[$key]) === 0) { $args[$key] = false; } else { return response('Invalid type of argument ' . quot($key) . ', expected bool', 400); } } elseif ($val['type'] == 'float') { if (!is_numeric($args[$key])) { return response('Invalid type of argument ' . quot($key) . ', expected float', 400); } else { $args[$key] = floatval($args[$key]); } } elseif ($val['type'] == 'int') { if (!is_numeric($args[$key])) { return response('Invalid type of argument ' . quot($key) . ', expected int', 400); } else { $args[$key] = intval($args[$key]); } } elseif ($val['type'] == 'string') { $args[$key] = strval($args[$key]); } else { log_msg('error', 'modules: invalid type given for argument ' . quot($key) . ' of service ' . quot($service)); } } } log_msg('info', 'modules: running service ' . quot($service)); return $services[$service]['func']($args); }
function iframe_save_state($args) { $elem = $args['elem']; $obj = $args['obj']; if (array_shift(elem_classes($elem)) != 'iframe') { return false; } // make sure the type is set $obj['type'] = 'iframe'; $obj['module'] = 'iframe'; // hook invoke_hook('alter_save', array('obj' => &$obj, 'elem' => $elem)); load_modules('glue'); $ret = save_object($obj); if ($ret['#error']) { log_msg('error', 'iframe_save_state: save_object returned ' . quot($ret['#data'])); return false; } else { return true; } }
function form($instance) { // outputs the options form on admin if (!function_exists('quot')) { function quot($txt) { return str_replace("\"", """, $txt); } } // format some of the options as valid html @($username = htmlspecialchars($instance['user'], ENT_QUOTES)); @($api = htmlspecialchars($instance['api'], ENT_QUOTES)); @($apisecret = htmlspecialchars($instance['apisecret'], ENT_QUOTES)); @($token = htmlspecialchars($instance['token'], ENT_QUOTES)); @($tokensecret = htmlspecialchars($instance['tokensecret'], ENT_QUOTES)); @($updateCount = htmlspecialchars($instance['count'], ENT_QUOTES)); @($showTwitterIconTF = $instance['showTwitterIconTF']); @($showProfilePicTF = $instance['showProfilePicTF']); @($showTweetTimeTF = $instance['showTweetTimeTF']); @($widgetTitle = stripslashes(quot($instance['widgetTitle']))); @($includeRepliesTF = $instance['includeRepliesTF']); ?> <p> <label for="<?php echo $this->get_field_id('user'); ?> " style="line-height:35px;display:block;"><?php _e("Twitter user: @", 'orizon'); ?> <input type="text" size="12" id="<?php echo $this->get_field_id('user'); ?> " name="<?php echo $this->get_field_name('user'); ?> " value="<?php echo $username; ?> " /></label> <label for="<?php echo $this->get_field_id('count'); ?> " style="line-height:35px;display:block;"><?php _e("Show", 'orizon'); ?> <input type="text" id="<?php echo $this->get_field_id('count'); ?> " size="2" name="<?php echo $this->get_field_name('count'); ?> " value="<?php echo $updateCount; ?> " /><?php _e("twitter updates", 'orizon'); ?> </label> <label for="<?php echo $this->get_field_id('widgetTitle'); ?> " style="line-height:35px;display:block;"><?php _e("Widget title:", 'orizon'); ?> <input type="text" id="<?php echo $this->get_field_id('widgetTitle'); ?> " size="16" name="<?php echo $this->get_field_name('widgetTitle'); ?> " value="<?php echo $widgetTitle; ?> " /></label> <p><input type="checkbox" id="<?php echo $this->get_field_id('includeRepliesTF'); ?> " value="1" name="<?php echo $this->get_field_name('includeRepliesTF'); ?> "<?php if ($includeRepliesTF) { ?> checked="checked"<?php } ?> > <label for="<?php echo $this->get_field_id('includeRepliesTF'); ?> "><?php _e("Include replies", 'orizon'); ?> </label></p> <br /> <?php _e('If your tweets doesn’t show up with this Application settings please register another twitter APP on https://apps.twitter.com/app', 'orizon'); ?> <br></br> <label for="<?php echo $this->get_field_id('api'); ?> " style="line-height:35px;display:block;"><?php _e("Api key:", 'orizon'); ?> <input placeholder="Cz2crWMRSc62Nlp1yagt9w" type="text" size="35" id="<?php echo $this->get_field_id('api'); ?> " name="<?php echo $this->get_field_name('api'); ?> " value="<?php echo $api; ?> " /></label> <label for="<?php echo $this->get_field_id('apisecret'); ?> " style="line-height:35px;display:block;"><?php _e("Api key secret: ", 'orizon'); ?> <input placeholder="UOwKXRriyG2l4oL8NKuqsEwr0pXEkPNEkhrxrftI4lE" type="text" size="35" id="<?php echo $this->get_field_id('apisecret'); ?> " name="<?php echo $this->get_field_name('apisecret'); ?> " value="<?php echo $apisecret; ?> " /></label> <label for="<?php echo $this->get_field_id('token'); ?> " style="line-height:35px;display:block;"><?php _e("Token: ", 'orizon'); ?> <input placeholder="764237641-JLC4OqK2WNkpWlNgc3pHWN68bmjl0s9669nldZ5I" type="text" size="35" id="<?php echo $this->get_field_id('token'); ?> " name="<?php echo $this->get_field_name('token'); ?> " value="<?php echo $token; ?> " /></label> <label for="<?php echo $this->get_field_id('tokensecret'); ?> " style="line-height:35px;display:block;"><?php _e("Token secret: ", 'orizon'); ?> <input placeholder="8Lo97YIwwLJn78FlFwZ80lw2iOHEyZ8wwcJ9xCTVv8" type="text" size="35" id="<?php echo $this->get_field_id('tokensecret'); ?> " name="<?php echo $this->get_field_name('tokensecret'); ?> " value="<?php echo $tokensecret; ?> " /></label> <p><?php _e("To style the output of the widget, modify", 'orizon'); ?> <a href="<?php echo home_url(); ?> /wp-content/plugins/latest-twitter-sidebar-widget/latest_twitter_widget.css"><?php _e("this CSS stylesheet", 'orizon'); ?> </a>. <?php _e("You should also back this file up before updating the plugin.", 'orizon'); ?> </p> </p> <?php }
UnknownUploadError: '<?php echo quot(UnknownUploadError); ?> ', Searching: '<?php echo quot(Searching); ?> ', SaveMailInSentItems: '<?php echo quot(SaveMailInSentItems); ?> ', TestButton: '<?php echo quot(TestButton); ?> ', NullLang: 'Null' }; var $Monthes = []; $Monthes[0] = Lang.Month; $Monthes[1] = Lang.January; $Monthes[2] = Lang.February; $Monthes[3] = Lang.March; $Monthes[4] = Lang.April; $Monthes[5] = Lang.May; $Monthes[6] = Lang.June; $Monthes[7] = Lang.July; $Monthes[8] = Lang.August;
function video_snapshot_symlink($args) { $obj = $args['obj']; if (!isset($obj['type']) || $obj['type'] != 'video') { return false; } $dest_dir = CONTENT_DIR . '/' . array_shift(expl('.', $obj['name'])) . '/shared'; $src_file = CONTENT_DIR . '/' . array_shift(expl('.', $args['origin'])) . '/shared/' . $obj['video-file']; if (($f = dir_has_same_file($dest_dir, $src_file)) !== false) { $obj['video-file'] = $f; } else { // copy file $dest_file = $dest_dir . '/' . unique_filename($dest_dir, $src_file); $m = umask(0111); if (!@copy($src_file, $dest_file)) { umask($m); log_msg('error', 'video_snapshot_symlink: error copying referenced file ' . quot($src_file) . ' to ' . quot($dest_file)); return false; } umask($m); $obj['video-file'] = basename($dest_file); log_msg('info', 'video_snapshot_symlink: copied referenced file to ' . quot($dest_file)); } $ret = save_object($obj); if ($ret['#error']) { log_msg('error', 'video_snapshot_symlink: error saving object ' . quot($obj['name'])); return false; } else { return true; } }
?> ', ShortMonthSeptember: '<?php echo quot(ShortMonthSeptember); ?> ', ShortMonthOctober: '<?php echo quot(ShortMonthOctober); ?> ', ShortMonthNovember: '<?php echo quot(ShortMonthNovember); ?> ', ShortMonthDecember: '<?php echo quot(ShortMonthDecember); ?> ' } var $Monthes = Array(); $Monthes[0] = Lang.Month; $Monthes[1] = Lang.January; $Monthes[2] = Lang.February; $Monthes[3] = Lang.March; $Monthes[4] = Lang.April; $Monthes[5] = Lang.May; $Monthes[6] = Lang.June; $Monthes[7] = Lang.July; $Monthes[8] = Lang.August; $Monthes[9] = Lang.September;
function form($instance) { // outputs the options form on admin if (!function_exists('quot')) { function quot($txt) { return str_replace("\"", """, $txt); } } // format some of the options as valid html $username = htmlspecialchars($instance['user'], ENT_QUOTES); $updateCount = htmlspecialchars($instance['count'], ENT_QUOTES); $showTweetTimeTF = $instance['showTweetTimeTF']; $widgetTitle = stripslashes(quot($instance['widgetTitle'])); ?> <p> <label for="<?php echo $this->get_field_id('user'); ?> " style="line-height:35px;display:block;"><?php _e('Twitter user:'******'framework'); ?> @<input type="text" size="12" id="<?php echo $this->get_field_id('user'); ?> " name="<?php echo $this->get_field_name('user'); ?> " value="<?php echo $username; ?> " /></label> <label for="<?php echo $this->get_field_id('count'); ?> " style="line-height:35px;display:block;"><?php _e('Show:', 'framework'); ?> <input type="text" id="<?php echo $this->get_field_id('count'); ?> " size="2" name="<?php echo $this->get_field_name('count'); ?> " value="<?php echo $updateCount; ?> " /> twitter updates</label> <label for="<?php echo $this->get_field_id('widgetTitle'); ?> " style="line-height:35px;display:block;"><?php _e('Widget title:', 'framework'); ?> : <input type="text" id="<?php echo $this->get_field_id('widgetTitle'); ?> " size="16" name="<?php echo $this->get_field_name('widgetTitle'); ?> " value="<?php echo $widgetTitle; ?> " /></label> <p><input type="checkbox" id="<?php echo $this->get_field_id('showTweetTimeTF'); ?> " value="1" name="<?php echo $this->get_field_name('showTweetTimeTF'); ?> "<?php if ($showTweetTimeTF) { ?> checked="checked"<?php } ?> > <label for="<?php echo $this->get_field_id('showTweetTimeTF'); ?> ">Show tweeted "time ago"</label></p> <p><strong>The wiget requires</strong> Consumer key, consumer secret, user token and access secret token set in theme options!</p> </p> <?php }